我创建了这个程序,要求 5 家公司输入当天的销售额。似乎工作正常。我想不通的是如何在所有 5 家公司都进入销售后显示图表。这是我到目前为止的代码。
#include <cstdlib>
#include <iostream>
using namespace std;
int main()
{
int sales = 0;
int store = 0;
float stars;
for (int store = 1; store <= 5; store++)
{
cout << "Enter today's sale for store " << store << ":";
cin >> sales;
stars = sales/100;
cout << "SALES BAR CHART:" << endl;
cout << "(Each * = $100)" << endl;
cout << "Store" << store << ":";
for (int y = 0; y < stars; y++)
{
cout << "*";
}
cout << endl;
}
system("PAUSE");
return EXIT_SUCCESS;
}