Master Pimp
Banned
Alright guys I am almost done But I need your help with 1 more thing.
I need to be able to cout the totals to the user. Thats what I am stuck on. UMM I know ur gunna hate me fopr psoting it but i dont know how to make it all small for u but here it is.
#include <iostream.h>
#include <string.h>
struct items_total
{
int item_number;
char item_name[30];
char discription[100];
float price;
};
int main()
{
int q;
int choice;
int itemselection;
int itemselection2;
int grill;
float total;
//------------------------------------------------------------------------
items_total item[16];
//------------------------------------------------------------------------
strcpy(item[1].item_name,"Snowflake Ornaments");
item[1].item_number = 19112;
strcpy(item[1].discription,"The perfect ornament for a Christmas tree.");
item[1].price = 10.00;
//------------------------------------------------------------------------
strcpy(item[2].item_name,"Reefs");
item[2].item_number = 19113;
strcpy(item[2].discription,"Hang them above your door.");
item[2].price = 10.00;
//------------------------------------------------------------------------
strcpy(item[3].item_name,"Train Set");
item[3].item_number = 19114;
strcpy(item[3].discription,"Looks like a real train set.");
item[3].price = 100.00;
//------------------------------------------------------------------------
strcpy(item[4].item_name,"Elf");
item[4].item_number = 19115;
strcpy(item[4].discription,"A real magical elf to grant wishes.");
item[4].price = 1000.00;
//------------------------------------------------------------------------
strcpy(item[5].item_name,"Santa");
item[5].item_number = 19116;
strcpy(item[5].discription,"Looks like a real Santa.");
item[5].price = 100.00;
//------------------------------------------------------------------------
strcpy(item[6].item_name,"Mrs.Claus");
item[6].item_number = 19117;
strcpy(item[6].discription,"Looks like a real Mrs.Claus.");
item[6].price = 100.00;
//------------------------------------------------------------------------
strcpy(item[7].item_name,"Deer");
item[7].item_number = 19118;
strcpy(item[7].discription,"Looks like a real deer.");
item[7].price = 10.00;
//------------------------------------------------------------------------
strcpy(item[8].item_name,"Lights");
item[8].item_number = 19119;
strcpy(item[8].discription,"Place them on your tree. It glows.");
item[8].price = 20.00;
//------------------------------------------------------------------------
strcpy(item[9].item_name,"Dradle");
item[9].item_number = 19120;
strcpy(item[9].discription,"Spin the dradle.");
item[9].price = 3.00;
//------------------------------------------------------------------------
strcpy(item[10].item_name,"Matza");
item[10].item_number = 19121;
strcpy(item[10].discription,"A nice thing to eat.");
item[10].price = 5.00;
//------------------------------------------------------------------------
strcpy(item[11].item_name,"Manorah");
item[11].item_number = 19122;
strcpy(item[11].discription,"Light it for all 8 days.");
item[11].price = 40.00;
//------------------------------------------------------------------------
strcpy(item[12].item_name,"Streamers");
item[12].item_number = 19123;
strcpy(item[12].discription,"Put them around your house for New Years Eve.");
item[12].price = 30.00;
//------------------------------------------------------------------------
strcpy(item[13].item_name,"Wine");
item[13].item_number = 19124;
strcpy(item[13].discription,"Drink it.");
item[13].price = 45.00;
//------------------------------------------------------------------------
strcpy(item[14].item_name,"Confetti");
item[14].item_number = 19125;
strcpy(item[14].discription,"Throw this.");
item[14].price = 2.00;
//------------------------------------------------------------------------
strcpy(item[15].item_name,"Yammaka");
item[15].item_number = 19126;
strcpy(item[15].discription,"Wear it on your head.");
item[15].price = 30.00;
//------------------------------------------------------------------------
do{
cout << "Would you like to see items for...\n";
cout << "1-Christmas\n";
cout << "2-Hanukkah\n";
cin >> choice;
switch(choice)
{
case 1:
cout << "Here are all christmas items" << endl;
cout << "Name: " << item[1].item_name << endl;
cout << "Item Number: " << item[1].item_number << endl;
cout << "Discription: " << item[1].discription << endl;
cout << "Price: " << item[1].price << endl;
cout << "Name: " << item[2].item_name << endl;
cout << "Item Number: " << item[2].item_number << endl;
cout << "Discription: " << item[2].discription << endl;
cout << "Price: " << item[2].price << endl;
cout << "Name: " << item[3].item_name << endl;
cout << "Item Number: " << item[3].item_number << endl;
cout << "Discription: " << item[3].discription << endl;
cout << "Price: " << item[3].price << endl;
cout << "Name: " << item[4].item_name << endl;
cout << "Item Number: " << item[4].item_number << endl;
cout << "Discription: " << item[4].discription << endl;
cout << "Price: " << item[4].price << endl;
cout << "Name: " << item[5].item_name << endl;
cout << "Item Number: " << item[5].item_number << endl;
cout << "Discription: " << item[5].discription << endl;
cout << "Price: " << item[5].price << endl;
cout << "Name: " << item[6].item_name << endl;
cout << "Item Number: " << item[6].item_number << endl;
cout << "Discription: " << item[6].discription << endl;
cout << "Price: " << item[6].price << endl;
cout << "Name: " << item[7].item_name << endl;
cout << "Item Number: " << item[7].item_number << endl;
cout << "Discription: " << item[7].discription << endl;
cout << "Price: " << item[7].price << endl;
cout << "Name: " << item[8].item_name << endl;
cout << "Item Number: " << item[8].item_number << endl;
cout << "Discription: " << item[8].discription << endl;
cout << "Price: " << item[8].price << endl;
cout << "ENTER THE ITEM NUMBER THAT U WANT!";
cin >> itemselection;
switch(itemselection)
{
case 19112:
cout << "You have selected " << item[1].item_name << " which costs $" << item[1].price << endl;
break;
case 19113:
cout << "You have selected " << item[2].item_name << " which costs $" << item[2].price << endl;
break;
case 19114:
cout << "You have selected " << item[3].item_name << " which costs $" << item[3].price << endl;
break;
case 19115:
cout << "You have selected " << item[4].item_name << " which costs $" << item[4].price << endl;
break;
case 19116:
cout << "You have selected " << item[5].item_name << " which costs $" << item[5].price << endl;
break;
case 19117:
cout << "You have selected " << item[6].item_name << " which costs $" << item[6].price << endl;
break;
case 19118:
cout << "You have selected " << item[7].item_name << " which costs $" << item[7].price << endl;
break;
case 19119:
cout << "You have selected " << item[8].item_name << " which costs $" << item[8].price << endl;
break;
default:
cout << "Incorrect Input";
break;
}
break;
case 2:
cout << "Here are all Hanukkah items" << endl;
cout << "Name: " << item[9].item_name << endl;
cout << "Item Number: " << item[9].item_number << endl;
cout << "Discription: " << item[9].discription << endl;
cout << "Price: " << item[9].price << endl;
cout << "Name: " << item[10].item_name << endl;
cout << "Item Number: " << item[10].item_number << endl;
cout << "Discription: " << item[10].discription << endl;
cout << "Price: " << item[10].price << endl;
cout << "Name: " << item[11].item_name << endl;
cout << "Item Number: " << item[11].item_number << endl;
cout << "Discription: " << item[11].discription << endl;
cout << "Price: " << item[11].price << endl;
cout << "Name: " << item[12].item_name << endl;
cout << "Item Number: " << item[12].item_number << endl;
cout << "Discription: " << item[12].discription << endl;
cout << "Price: " << item[12].price << endl;
cout << "Name: " << item[13].item_name << endl;
cout << "Item Number: " << item[13].item_number << endl;
cout << "Discription: " << item[13].discription << endl;
cout << "Price: " << item[13].price << endl;
cout << "Name: " << item[14].item_name << endl;
cout << "Item Number: " << item[14].item_number << endl;
cout << "Discription: " << item[14].discription << endl;
cout << "Price: " << item[14].price << endl;
cout << "Name: " << item[15].item_name << endl;
cout << "Item Number: " << item[15].item_number << endl;
cout << "Discription: " << item[15].discription << endl;
cout << "Price: " << item[15].price << endl;
cout << "-=-=Enter The Item Number=-=-";
cin >> itemselection2;
switch(itemselection2)
{
case 19120:
cout << "You have selected " << item[9].item_name << " which costs $" << item[9].price << endl;
break;
case 19121:
cout << "You have selected " << item[10].item_name << " which costs $" << item[10].price << endl;
break;
case 19122:
cout << "You have selected " << item[11].item_name << " which costs $" << item[11].price << endl;
break;
case 19123:
cout << "You have selected " << item[12].item_name << " which costs $" << item[12].price << endl;
break;
case 19124:
cout << "You have selected " << item[13].item_name << " which costs $" << item[13].price << endl;
break;
case 19125:
cout << "You have selected " << item[14].item_name << " which costs $" << item[14].price << endl;
break;
case 19126:
cout << "You have selected " << item[15].item_name << " which costs $" << item[15].price << endl;
break;
default:
cout << "Incorrect Input";
break;
}
break;
default:
cout << "Incorrect Input";
break;
}
cout << "Would you like to purchase more?\n 1-Yes\n 2-No, Total\n";
cin >> grill;
}while(grill == 1);
if(grill ==2)
cout << total;
cin >> q;
return 0;
}
I need to be able to cout the totals to the user. Thats what I am stuck on. UMM I know ur gunna hate me fopr psoting it but i dont know how to make it all small for u but here it is.
#include <iostream.h>
#include <string.h>
struct items_total
{
int item_number;
char item_name[30];
char discription[100];
float price;
};
int main()
{
int q;
int choice;
int itemselection;
int itemselection2;
int grill;
float total;
//------------------------------------------------------------------------
items_total item[16];
//------------------------------------------------------------------------
strcpy(item[1].item_name,"Snowflake Ornaments");
item[1].item_number = 19112;
strcpy(item[1].discription,"The perfect ornament for a Christmas tree.");
item[1].price = 10.00;
//------------------------------------------------------------------------
strcpy(item[2].item_name,"Reefs");
item[2].item_number = 19113;
strcpy(item[2].discription,"Hang them above your door.");
item[2].price = 10.00;
//------------------------------------------------------------------------
strcpy(item[3].item_name,"Train Set");
item[3].item_number = 19114;
strcpy(item[3].discription,"Looks like a real train set.");
item[3].price = 100.00;
//------------------------------------------------------------------------
strcpy(item[4].item_name,"Elf");
item[4].item_number = 19115;
strcpy(item[4].discription,"A real magical elf to grant wishes.");
item[4].price = 1000.00;
//------------------------------------------------------------------------
strcpy(item[5].item_name,"Santa");
item[5].item_number = 19116;
strcpy(item[5].discription,"Looks like a real Santa.");
item[5].price = 100.00;
//------------------------------------------------------------------------
strcpy(item[6].item_name,"Mrs.Claus");
item[6].item_number = 19117;
strcpy(item[6].discription,"Looks like a real Mrs.Claus.");
item[6].price = 100.00;
//------------------------------------------------------------------------
strcpy(item[7].item_name,"Deer");
item[7].item_number = 19118;
strcpy(item[7].discription,"Looks like a real deer.");
item[7].price = 10.00;
//------------------------------------------------------------------------
strcpy(item[8].item_name,"Lights");
item[8].item_number = 19119;
strcpy(item[8].discription,"Place them on your tree. It glows.");
item[8].price = 20.00;
//------------------------------------------------------------------------
strcpy(item[9].item_name,"Dradle");
item[9].item_number = 19120;
strcpy(item[9].discription,"Spin the dradle.");
item[9].price = 3.00;
//------------------------------------------------------------------------
strcpy(item[10].item_name,"Matza");
item[10].item_number = 19121;
strcpy(item[10].discription,"A nice thing to eat.");
item[10].price = 5.00;
//------------------------------------------------------------------------
strcpy(item[11].item_name,"Manorah");
item[11].item_number = 19122;
strcpy(item[11].discription,"Light it for all 8 days.");
item[11].price = 40.00;
//------------------------------------------------------------------------
strcpy(item[12].item_name,"Streamers");
item[12].item_number = 19123;
strcpy(item[12].discription,"Put them around your house for New Years Eve.");
item[12].price = 30.00;
//------------------------------------------------------------------------
strcpy(item[13].item_name,"Wine");
item[13].item_number = 19124;
strcpy(item[13].discription,"Drink it.");
item[13].price = 45.00;
//------------------------------------------------------------------------
strcpy(item[14].item_name,"Confetti");
item[14].item_number = 19125;
strcpy(item[14].discription,"Throw this.");
item[14].price = 2.00;
//------------------------------------------------------------------------
strcpy(item[15].item_name,"Yammaka");
item[15].item_number = 19126;
strcpy(item[15].discription,"Wear it on your head.");
item[15].price = 30.00;
//------------------------------------------------------------------------
do{
cout << "Would you like to see items for...\n";
cout << "1-Christmas\n";
cout << "2-Hanukkah\n";
cin >> choice;
switch(choice)
{
case 1:
cout << "Here are all christmas items" << endl;
cout << "Name: " << item[1].item_name << endl;
cout << "Item Number: " << item[1].item_number << endl;
cout << "Discription: " << item[1].discription << endl;
cout << "Price: " << item[1].price << endl;
cout << "Name: " << item[2].item_name << endl;
cout << "Item Number: " << item[2].item_number << endl;
cout << "Discription: " << item[2].discription << endl;
cout << "Price: " << item[2].price << endl;
cout << "Name: " << item[3].item_name << endl;
cout << "Item Number: " << item[3].item_number << endl;
cout << "Discription: " << item[3].discription << endl;
cout << "Price: " << item[3].price << endl;
cout << "Name: " << item[4].item_name << endl;
cout << "Item Number: " << item[4].item_number << endl;
cout << "Discription: " << item[4].discription << endl;
cout << "Price: " << item[4].price << endl;
cout << "Name: " << item[5].item_name << endl;
cout << "Item Number: " << item[5].item_number << endl;
cout << "Discription: " << item[5].discription << endl;
cout << "Price: " << item[5].price << endl;
cout << "Name: " << item[6].item_name << endl;
cout << "Item Number: " << item[6].item_number << endl;
cout << "Discription: " << item[6].discription << endl;
cout << "Price: " << item[6].price << endl;
cout << "Name: " << item[7].item_name << endl;
cout << "Item Number: " << item[7].item_number << endl;
cout << "Discription: " << item[7].discription << endl;
cout << "Price: " << item[7].price << endl;
cout << "Name: " << item[8].item_name << endl;
cout << "Item Number: " << item[8].item_number << endl;
cout << "Discription: " << item[8].discription << endl;
cout << "Price: " << item[8].price << endl;
cout << "ENTER THE ITEM NUMBER THAT U WANT!";
cin >> itemselection;
switch(itemselection)
{
case 19112:
cout << "You have selected " << item[1].item_name << " which costs $" << item[1].price << endl;
break;
case 19113:
cout << "You have selected " << item[2].item_name << " which costs $" << item[2].price << endl;
break;
case 19114:
cout << "You have selected " << item[3].item_name << " which costs $" << item[3].price << endl;
break;
case 19115:
cout << "You have selected " << item[4].item_name << " which costs $" << item[4].price << endl;
break;
case 19116:
cout << "You have selected " << item[5].item_name << " which costs $" << item[5].price << endl;
break;
case 19117:
cout << "You have selected " << item[6].item_name << " which costs $" << item[6].price << endl;
break;
case 19118:
cout << "You have selected " << item[7].item_name << " which costs $" << item[7].price << endl;
break;
case 19119:
cout << "You have selected " << item[8].item_name << " which costs $" << item[8].price << endl;
break;
default:
cout << "Incorrect Input";
break;
}
break;
case 2:
cout << "Here are all Hanukkah items" << endl;
cout << "Name: " << item[9].item_name << endl;
cout << "Item Number: " << item[9].item_number << endl;
cout << "Discription: " << item[9].discription << endl;
cout << "Price: " << item[9].price << endl;
cout << "Name: " << item[10].item_name << endl;
cout << "Item Number: " << item[10].item_number << endl;
cout << "Discription: " << item[10].discription << endl;
cout << "Price: " << item[10].price << endl;
cout << "Name: " << item[11].item_name << endl;
cout << "Item Number: " << item[11].item_number << endl;
cout << "Discription: " << item[11].discription << endl;
cout << "Price: " << item[11].price << endl;
cout << "Name: " << item[12].item_name << endl;
cout << "Item Number: " << item[12].item_number << endl;
cout << "Discription: " << item[12].discription << endl;
cout << "Price: " << item[12].price << endl;
cout << "Name: " << item[13].item_name << endl;
cout << "Item Number: " << item[13].item_number << endl;
cout << "Discription: " << item[13].discription << endl;
cout << "Price: " << item[13].price << endl;
cout << "Name: " << item[14].item_name << endl;
cout << "Item Number: " << item[14].item_number << endl;
cout << "Discription: " << item[14].discription << endl;
cout << "Price: " << item[14].price << endl;
cout << "Name: " << item[15].item_name << endl;
cout << "Item Number: " << item[15].item_number << endl;
cout << "Discription: " << item[15].discription << endl;
cout << "Price: " << item[15].price << endl;
cout << "-=-=Enter The Item Number=-=-";
cin >> itemselection2;
switch(itemselection2)
{
case 19120:
cout << "You have selected " << item[9].item_name << " which costs $" << item[9].price << endl;
break;
case 19121:
cout << "You have selected " << item[10].item_name << " which costs $" << item[10].price << endl;
break;
case 19122:
cout << "You have selected " << item[11].item_name << " which costs $" << item[11].price << endl;
break;
case 19123:
cout << "You have selected " << item[12].item_name << " which costs $" << item[12].price << endl;
break;
case 19124:
cout << "You have selected " << item[13].item_name << " which costs $" << item[13].price << endl;
break;
case 19125:
cout << "You have selected " << item[14].item_name << " which costs $" << item[14].price << endl;
break;
case 19126:
cout << "You have selected " << item[15].item_name << " which costs $" << item[15].price << endl;
break;
default:
cout << "Incorrect Input";
break;
}
break;
default:
cout << "Incorrect Input";
break;
}
cout << "Would you like to purchase more?\n 1-Yes\n 2-No, Total\n";
cin >> grill;
}while(grill == 1);
if(grill ==2)
cout << total;
cin >> q;
return 0;
}