我需要創建一個程序,該程序可以進入每週每天的每日銷售。一旦值輸入我需要能夠顯示:我需要顯示最高和最低的銷售價值
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功能,所以我迷失在如何完成它。
我的代碼,我至今是:
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;
任何幫助,將不勝感激!