#include <iostream> #include <iomanip> using namespace std; int main() { //decla
ID: 3805895 • Letter: #
Question
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
//declare the store in array
int store[10];
//using for loop, get the sales for store from user
for (int s = 0; s <5; s++)
{
cout << "Enter today's sale for store " << s + 1 << ":";
//get the sale for store from uset
cin >> store[s];
//increment the store
}
//for display
cout << "SALES BAR CHART:" << endl;
cout << "(Each * = $100)" << endl;
//for print *
for (int st = 0; st <5; st++)
{
//display the store
cout << "Store " << st + 1 << ":";
//print * for corresponding store using for loop
for (int sa = 0; sa < store[st] / 100; sa++)
{
cout << "*";
}
cout << endl;
}
system("pause");
return 0;}
how to write pseudo code? that os c++
Explanation / Answer
Pseudo Code:
Pseudo code:
1. Start
2. Declare an integer array store of size 10
3. for s = 0 to 4 do
3.1 Prompt user for today's sale
3.2 Read value from user and store in store[s]
3.3 Increment s = s + 1
end do
4. Display heading "SALES BAR CHART:"
5. for st = 0 to 4 do
5.1 Display Store number "Store (s+1)"
5.2 for sa = 0 to (store[st]/100) - 1 do
5.2.1 Print *
5.2.2 Increment sa = sa + 1
end do
5.3 Read value from user and store in store[s]
5.4 Print new line
5.5 Increment st = st + 1
end do
6. Stop
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.