Create a program using C microsoft visual studios 2013 usin

Create a program using C ++ (microsoft visual studios 2013) using atleast one for loop that displays the sales amounts made in each of four regions (north, south, east and west) for t 3 month period. The program should allow the user to enter 4 sets (one set for each region) of three sales amounts (one amount for each month). The program should display each regions total sales for the 3 month period. Example data(remember that the user should be able to enter any data they wish as long as it follows the format below):

north 2000, 3400, 4000

south 2232, 3434, 6777

east 2222, 5555, 1035

west 1111, 4000, 4444

Solution

#include <iostream>

using namespace std;

int main()
{
int n = 4;
string regions[n];
int salesAmount[n][3];

for(int i=0; i<n; i++){
cout<<\"Enter the region and 3 months sales amounts: \";
cin >> regions[i]>>salesAmount[i][0]>>salesAmount[i][1]>>salesAmount[i][2];
}
for(int i=0; i<n; i++){
cout<<\"Region: \"<<regions[i]<<\" Total sale amount: \"<<(salesAmount[i][0]+salesAmount[i][1]+salesAmount[i][2])<<endl;
}

return 0;
}

Output:

sh-4.2$ g++ -o main *.cpp                                                                                                                                                                                                                                              

sh-4.2$ main                                                                                                                                                                                                                                                           

Enter the region and 3 months sales amounts: north 2000 3400 4000                                                                                                                                                                                                      

Enter the region and 3 months sales amounts: south 2232 3434 6777                                                                                                                                                                                                      

Enter the region and 3 months sales amounts: east 2222 5555 1035                                                                                                                                                                                                       

Enter the region and 3 months sales amounts: west 1111 4000 4444                                                                                                                                                                                                       

Region: north Total sale amount: 9400                                                                                                                                                                                                                                  

Region: south Total sale amount: 12443                                                                                                                                                                                                                                 

Region: east Total sale amount: 8812                                                                                                                                                                                                                                   

Region: west Total sale amount: 9555

Create a program using C ++ (microsoft visual studios 2013) using atleast one for loop that displays the sales amounts made in each of four regions (north, sout
Create a program using C ++ (microsoft visual studios 2013) using atleast one for loop that displays the sales amounts made in each of four regions (north, sout

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site