|
-
May 14th, 2013, 05:15 PM
#1
Need Help to Solve Errors Please!
I'm a beginner at c programming and i'm trying to write a program to accept the user's name, address and so on. This program should also display a list of items for them to select from, and also to calculate the cost of multiple items selected. I don't know much about c programming, and so far all i have is this:
Code:
#include <stdio.h>
#include <stdlib.h>
float calcCost();
void main()
{
char FName[100];
char LName[100];
char address[100];
char catType[100];
char rings;
char watches;
char chains;
char date[50];
printf("Please enter your first name:");
scanf("%s", &FName);
printf("\n");
printf("Please enter your last name:");
scanf("%s",&LName);
printf("\n");
printf("Please enter your address:");
scanf("%s",&address);
printf("\n");
printf("Please enter date:");
scanf("%s",&date);
printf("\n");
printf("Item Listing\n");
printf("\n");
printf("Categories\n");
printf("Men's Watches\n");
printf("Men's Chains\n");
printf("Men's Rings\n");
printf("To expand each category, enter a category code.(Either watches, chains or rings):\n");
scanf ("%s",&catType);
printf("\n");
if(catType =="watches")
{
printf("Gold and black watch with rubber bands - Item ID: MGW1\n");
printf("Gold watch with black watch face - Item ID: MGW2\n");
printf("Gold watch with black leather bands - Item ID: MGW3\n");
printf("Gold chronograph solar aviator watch - Item ID: MGW4\n");
printf("Gold sports chronograph with gold and silver band - Item ID MGW5\n");
}
else if(catType == "chains")
{
printf("10k Gold, square link chain, Cost:$1500 - Item ID: MGC1\n");
printf("14k Gold large link, 3 small link chain, Cost:$2500 - Item ID:MGC2\n");
printf("Gold chain with buddah's head pendant, Cost:$2800 - Item ID:MGC3\n");
printf("Gold chain with sideway cross, Cost:$2900 - Item ID:MGC4\n");
printf("Silver chain with blue cat's eye scorpion pendant, Cost:$3000 - Item ID:MSC1");
printf("Silver dogtag with tribal symbol, Cost:$1500 - Item ID:MSC2");
printf("Silver carving chain, Cost:$2000 - Item ID:MSC3");
printf("Silver chain with thick, square links, Cost:$2300 - Item ID:MSC4");
printf("Silver chain with black onyx and diamond cross pendant, Cost:$3500 - Item ID:MSC5");
}
else if(catType == "rings")
{
printf("Gold ring with gold encrusted black onyx, Cost:$3500- Item ID:MGR1");
printf("Gold ring with with phoenix emblem, Cost:$3800- Item ID: MGR2");
printf("10k gold nugget ring with onyx and tiger's eye, Cost:$4300- Item ID: MGR3");
printf("Gold eagle embeded onyx ring with diamonds, Cost:$5200- Item ID: MRG4");
printf("Gold ring with black onyx, Cost:$4000- Item ID: MGR5");
printf("Silver diamond cross ring with black pearl, Cost:$5500- Item ID:MSR1");
printf("Silver watch ring line with gold, Cost:$380- Item ID:MSR2");
printf("Silver ring with rectangular onyx stone, Cost:$2300- Item ID:MSR3");
printf("Four-layer square sterling silver ring, Cost:$5200- Item ID:MSR4");
printf("Celtic weave sterling silver ring, Cost:$2000- Item ID:MSR5");
}
system("pause");
return 0;
}
float calcCost(){
}
(*whenever I run this program, everything works fine except for the fact that the list won't show. How do I correct this please?*)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|