codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
#include<stdio.h> #include<conio.h> int category, item, price[5][5], limit, x, y, z; char product[5][5][30], type[5][30]; main() { clrscr(); x = 1; type[x][30] = "Gaming Consoles"; product[x][1][30] = "Nintendo DS"; price[x][1] = 6400; product[x][2][30] = "Sony PSP-3000"; price[x][2] = 6600; product[x][3][30] = "Nintendo Wii"; price[x][3] = 9400; product[x][4][30] = "Microsoft XBOX360"; price[x][4] = 12200; product[x][5][30] = "Sony PS3"; price[x][5] = 14200; x = 2; type[x][30] = "Phones"; product[x][1][30] = "Samsung Galaxy S 4G"; price[x][1] = 11500; product[x][2][30] = "HTC Thunderbolt"; price[x][2] = 13600; product[x][3][30] = "Nokia N8"; price[x][3] = 33500; product[x][4][30] = "iPhone 4"; price[x][4] = 44200; product[x][5][30] = "RIM BlackBerry Bold 9700"; price[x][5] = 48300; x = 3; type[x][30] = "Laptops"; product[x][1][30] = "Gateway NV51B05u"; price[x][1] = 28500; product[x][2][30] = "Asus U31JG A1"; price[x][2] = 45600; product[x][3][30] = "Acer Iconia 6120"; price[x][3] = 50650; product[x][4][30] = "Apple MacBook Pro"; price[x][4] = 65000; product[x][5][30] = "HP Envy 17"; price[x][5] = 90500; x = 4; product[x][1][30] = "Westinghouse SK-26H640G"; price[4][1] = 28500; product[x][2][30] = "LG Infinia 60PX950"; price[4][2] = 60650; product[x][3][30] = "Vizio Razor XVT3D650SV"; price[4][3] = 71000; product[x][4][30] = "Samsung LN26C350"; price[4][4] = 96000; product[x][5][30] = "Sony Bravia KDL-46EX720"; price[4][5] = 110500; x = 5; type[x][30] = "Earphones"; product[x][1][30] = "MeElectronics M9"; price[5][1] = 1200; product[x][2][30] = "Jays A-Jays Four"; price[5][2] = 4150; product[x][3][30] = "Klipsch Image S4"; price[5][3] = 5550; product[x][4][30] = "Monster Beats by Dr. Dre Tour"; price[5][4] = 12550; product[x][5][30] = "Shure SE535"; price[5][5] = 21500; //start printf("Welcome to the VicStore!\nWith this program, you can find our products sorted by category and filtered by a price range.\n\nPlease press the desired key: \n"); printf("[1] %s\n[2] %s\n[3] %s\n[4] %s\n[5] %s", type[1][30], type[2][30], type[3][30], type[4][30], type[5][30]); category = getch() - 48; clrscr(); printf("%s List:\n\n[%d] %s\n[%d] %s\n[%d] %s\n[%d] %s\n[%d] %s\n\nPlease enter the maximum price to filter down the list: ", type[category][30], price[category][1], product[category][1][30], price[category][2], product[category][2][30], price[category][3], product[category][3][30], price[category][4], product[category][4][30], price[category][5], product[category][5][30]); scanf("%d", &limit); clrscr(); printf("%s suited for your budget: \n\n", type[category][30]); for(item = 1; item < 6; item++) { if(limit > price[category][item]) { printf("[%d] %s\n", price[category][item], product[category][item][30]); } } getch(); }
Private
[
?
]
Run code
Submit