我需要创建一个程序,输入一周中每一天的每日销售额。输入值后,我需要能够显示:
Sales for day 1 are ###
Sales for day 2 are ###
The lowest sales was XXX
The highest sales was XXX
问题是我无法让我的代码输出:
Sales for day 1 are XXX
Sales for day 2 are XXX
我只能说
Sales are:
XXX
XXX
XXX
而且我也不知道如何找到最低和最高的销售额。我们甚至还没有开始使用 MIN 和 MAX 函数,所以我不知道如何完成它。
到目前为止,我的代码是:
const int DAYS_SALES = 7;
double sales[DAYS_SALES];
int sub;
double min = 0;
double max = 0;
for(sub = 0; sub < DAYS_SALES; ++sub)
{
cout << "Enter in the sales for day " << (sub + 1) << " ";
cin >> sales[sub];
}
cout << endl << "The sales for day are: " << endl;
for (sub = 0; sub < DAYS_SALES; ++sub)
cout << sales[sub] << " " << endl;
任何帮助,将不胜感激!