Any help would be greatly appreciated.
Here is my code:
Expand|Select|Wrap|Line Numbers
- #include <iostream>
- using namespace std;
- int main(){
- int product;
- int one[7];
- int two[7];
- int three[7];
- int four[7];
- int five[7];
- double total = 0;
- for(int i = 0; i < 7; i++){
- cout << "What products were sold on day " << i+1 << " (1 - 5 or EOF to end entry)? ";
- while( (product = cin.get()) != EOF){
- switch(product){
- case '1':
- ++one[i];
- break;
- case '2':
- ++two[i];
- break;
- case '3':
- ++three[i];
- break;
- case '4':
- ++four[i];
- break;
- case '5':
- ++five[i];
- break;
- case ' ':
- case '\n':
- case '\t':
- break;
- default:
- cout<< "Incorrect entry. \n";
- }
- }
- total += (one[i]*2.98 + two[i]*4.5 + three[i]*9.98 + four[i]*4.49 + five[i]*6.87);
- }
- cout << "Total retail price for the week is " << total;
- cin.get();
- return 0;
- }