#include <string>
#include <vector>
#include <iomanip>
#include <istream>
#include <fstream>
#include "...\myUtils.cpp"
void inputCases(string[], vector<double>);
void inputPrice(string[], vector<double>);
void displayReport(string[], vector<double>, vector<double>);
using namespace std;
int main()
{
double tmpCases, tmpPayRate;
vector <double> cases;
vector <double> payRates;
ofstream file;
file.open("salsaCase.txt");
string tmpName[5];
tmpName[0]="Mild";
tmpName[1]="Medium";
tmpName[2]="Sweet";
tmpName[3]="Hot";
tmpName[4]="Zesty";
char mans=0;
do
{//menu
cout<<"1. Input Price\n";
cout<<"2. Input Cases Sold\n";
cout<<"3. Display Report\n";
cout<<"4. Quit\n";
cin>>mans;
while (mans <1 || mans > 4)
{
cout <<"Please enter a valid menu choice(1-4)\n";
cin>>mans;
}
if (mans !=4)
{//guts of menu
switch (mans)
{
case 1:
void inputPrice(string tmpName[], vector<double> payRates);
break;
case 2:
void inputCases(string tmpName[], vector<double> cases);
break;
case 3:
void displayReport(string tmpName[], vector<double> payRates, vector<double> cases);
break;
}
if (mans == 4)
exit(0);
}
}
//function definitions
//input price per case
//ERROR happens right below here
void inputPrice (string tmpName[] ,vector<double> payRates)
{
for(int i=0;i<5;i++)
{
cout<<"Enter price for one case of "<< tmpName[i] <<": ";
cin >> tmpPayRate;
payRates.push_back(tmpPayRate);
cin.ignore();
pause();
}
}
//input number of cases
void inputCases(string tmpName[] ,vector<double> cases)
{
for(int i=0;i<5;i++)
{
cout << "Enter # of cases of "<< tmpName[i] <<" salsa : ";
cin >> tmpCases;
cases.push_back(tmpCases);
cin.ignore();
pause();
}
}//show sales
int displayReport(string tmpName[], vector<double> payRates, vector<double> cases)
{
cout<< setprecision(2)<<fixed<<showpoint;
file<< setprecision(2)<<fixed<<showpoint;
cout<<setw(20) << left << " Names"
<<setw(10) << right<< "Hours"
<<setw(10) << "Price"
<<setw(15) <<"GrossPay\n";
file<<setw(20) << left << " Name"
<<setw(10) << right<< "Hours"
<<setw(10) << "Price"
<<setw(15) <<"GrossPay\n";
for(int i=0;i<cases.size();i++)
{
//loop for generating salsa case lists
double grossPay =cases[i]*payRates[i];
cout<<setw(20) << left << tmpName[i]
<<setw(10) << right << cases[i]
<<setw(10) << payRates[i]
<<setw(15) << grossPay <<"\n";
file<<setw(20) << left << tmpName[i]
<<setw(10) << right << cases[i]
<<setw(10) << payRates[i]
<<setw(15) << grossPay <<"\n";
file.flush();
pause();
}
}
file.close();
pause("\n\n\nPress a key to terminate...");
exit(0);
}
using DevC++ only because my teacher says so
following is compiler error codes
E:\COP2\classNotes\1stdraft.cpp: In function `int main()':
E:\COP2\classNotes\1stdraft.cpp:66: error: expected `while' before "inputPrice"
E:\COP2\classNotes\1stdraft.cpp:66: error: expected `(' before "inputPrice"
E:\COP2\classNotes\1stdraft.cpp:66: error: expected primary-expression before "tmpName"
E:\COP2\classNotes\1stdraft.cpp:66: error: expected primary-expression before "payRates"
E:\COP2\classNotes\1stdraft.cpp:67: error: expected `)' before '{' token
E:\COP2\classNotes\1stdraft.cpp:67: error: expected `;' before '{' token
E:\COP2\classNotes\1stdraft.cpp:79: error: a function-definition is not allowed here before '{' token
E:\COP2\classNotes\1stdraft.cpp:79: error: expected `,' or `;' before '{' token
E:\COP2\classNotes\1stdraft.cpp:90: error: a function-definition is not allowed here before '{' token
E:\COP2\classNotes\1stdraft.cpp:90: error: expected `,' or `;' before '{' token
Execution terminated