Bars of service on a cell phone

Program is supposed to display asterisks or blank space depending on the user's input to show the bars of service on a cell phone. I need the "bars" to face the other way (The shorter end on the left and the taller end on the right)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// This program displays the bars of a cellphone depending on the user's input

#include <iostream>

using namespace std;

int main(){

	int numberOfBars, row;

	cout << "How many bars of service does the phone have? " ;
	cin >> numberOfBars ;

	for (row = 0; row <= numberOfBars; row++){        //loop to take care of the rows
for (int col = 0; col < numberOfBars; col++){   //loop to take care of the spaces
cout << ' ';                                //printing empty spaces
}                                           //end 1st inner for loop

for (int z =0 ; z<row;z++){                //loop to take care of the stars
cout << '*';                               //printing stars
}                                        //end second inner for loop
cout << endl;//change line
}//end outer for
}
Last edited on
Topic archived. No new replies allowed.