|
-
March 24th, 2009, 09:34 AM
#1
3 fields in one line "homework help"
I don't expect anyone to do my homework for me but can someone give me some pointers... I would like to have 3 entry fields in one line, average all 3 entrys, and also the sum of all 3 for example
Enter Northern Sales ______, _______, _______,
Enter Northern Sales 100, 200, 300
The actual problem is:
Create a program that displays the sum of sales amounts made in each of four regions during a three month period. The program should also display the total sales made during the three months. The program should display each regions total sales for the three-month period, and the company's total sales for the three month period.
By the way if you do read this I realized while typing this up that it doesn't need the average so I just need tips of 3 fields in one line... I have to take out the average part
Code:
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
int main()
{
//declare variables
double north = 0.0;
double south = 0.0;
double east = 0.0;
double west = 0.0;
double average = 0.0;
double averageNorth = 0.0;
double averageSouth = 0.0;
double averageWest = 0.0;
double averageEast = 0.0;
double norTol = 0.0;
double souTol = 0.0;
double easTol = 0.0;
double wesTol = 0.0;
//input value
cout << "Enter Northern Regional Sales ";
cin >> north;
cout << "Enter Southern Regional Sales ";
cin >> south;
cout << "Enter Eastern Regional Sales ";
cin >> east;
cout << "Enter Western Regional Sales ";
cin >> west;
//calculate change
averageNorth = (north/3);
averageSouth = (south/3);
averageWest = (west/3);
averageEast = (east/3);
//display output
cout <<"Northern Regional Average: " << averageNorth <<endl;
cout <<"Northern Sales Total: " << norTol<<endl;
cout <<"Southern Regional Average: " << averageSouth <<endl;
cout <<"Northern Sales Total: " << souTol<<endl;
cout <<"Eastern Regional Average: " << averageEast <<endl;
cout <<"Eastern Sales Total: " << easTol<<endl;
cout <<"Western Regional Average: " << averageWest <<endl;
cout <<"Western Sales Total: " << wesTol<<endl;
system ("pause");
return 0;
} //end of main function
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
|