/*
Irwin Blanc
mtg2
shirts.cpp
*/
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
enum Shirtypes{ Long,Long_x,Short,Silk,Cotton,Wool,Blue,Black,Green};
struct Shirt
{
Shirtypes types;
int sleeveType;
int material;
int size;
int price;
int color;
};
//Global constants
const string shirtypes[]={"Long","Long_x","Short","Silk","Cotton","Wool","Blue","Black","Green"};
//Function Protypes
Shirt GetShirt(Shirt);
void DisplayShirts(Shirt[],int); // have to create a function that accepts a Shirt arrayand the size of the array as parameters
void CalculateTotals(Shirt[],int,int&,int&,float&);
int main()
{
const int my_Shirts=100;// Array size
int Shirts[my_Shirts];//Array
Shirt t1,t2,t3,t4,t5,t6,t7,t8,t9;
int option;
//Diplay menu
cout << "\nDatabase" << endl
<< "\n\t1. Enter shirts into the database" << endl
<< "\t2. Display shirts available" << endl
<< "\t3. Display Report total" << endl
<< "\t4. Exit" << endl
<< "\n\tPick an option (1-4): ";
cin >> option;
// Menu-driven application
switch(option)
{
case 1: //Prompts user for data of one shirt
t1.types=Long;
t2.types=Long_x;
t3.types=Short;
t4.types=Silk;
t5.types=Cotton;
t6.types=Wool;
t7.types=Blue;
t8.types=Black;
t9.types=Green;
GetShirt(t1);
GetShirt(t2);
GetShirt(t3);
GetShirt(t4);
GetShirt(t5);
GetShirt(t6);
GetShirt(t7);
GetShirt(t8);
GetShirt(t9);
break;
case 2: // Display available shirts
break;
case 3: // Reports totals
break;
case 4:// Exit
break;
}
return 0;
}
//Shirt GetShirt(Shirt)
//Prompts user for data of one shirt
//return value:Shirt
Shirt GetShirt(Shirt& t)
{
//Prompts user for shirt
do
{
cout << " Please enter data for shirt: " << shirtypes[t.types] <<endl;
cout << "\tSleeveType: ";
cin >> t.sleeveType;
cout << "\tMaterial: ";
cin >> t.material;
cout << "\tSize: ";
cin >> t.size;
cout << "\tPrice: ";
cin >> t.price;
cout << "\tColor: ";
cin >> t.color;
if(t.size<0||t.price<0)
cout << "Error... No negative numbers allowed. " << endl;
}while(t.size<0||t.price<0);
return Shirt; //error Expected primary expression before ';' token
}
Last edited on
return Shirt;
Shirt is not a variable.