Here is my questions:
Write an interactive program for a grocery store which will ask for the transaction year, user's name entering the data and will request from the user total monthly sales for each month through the year. The output will be the total sales per quarter, average quarterly sales, total annual sales and average annual sales.
What am I doing wrong
#include <iostream.h>
int main ( )
{
int transYear, userName, num;
double month1,month2,month3,month4,month5,month6,month7,m onth8,month9,month10,month11,month12;
double qrt1, qrt2, qrt3, qrt4, qrtAvg, annlSales, annlAvg;
qrtAvg = (qrt1+qrt2+qrt3+qrt4)/4;
annlSales = (month1+month2+month3+month4+month5+month6+month7+ month8+month9+month10+month11+month12);
annlAvg = (month1+month2+month3+month4+month5+month6+month7+ month8+month9+month10+month11+month12)/12;
cout << "Enter transaction year: \n" ;
cin >> transYear;
cout << "Enter user name: \n";
cin >> userName;
cout << "Enter montly sales separated by space: ";
cout << endl;
cin >> month1>> month2>> month3>> month4>> month5>> month6>> month7>> month8>> month9>> month10>> month11>> month12;
cout << "Sales per quarter are: \n" << qrt1 << "\n"<< qrt2 <<"\n"<< qrt3 <<"\n"<< qrt4;
cout << endl;
cout << "Average quarterly sales are: \n" << qrtAvg;
cout << endl;
cout << "Total annual sales are: \n" << annlSales;
return 0;
}
|