I'm been working with this program trying to come up with this output:
I can't get the box or zeros to appear right. I got first and last row of the box seems to get messed up and when I set the counter equal to the rows (not displayed in code) it won't seem to work. Any one got a solution. Thanks!
Drawing program
Do you want to start(Y/N)? Y
How many rows/columns(5-21)? 7
0******
*0*****
**0****
***0***
****0**
*****0*
******0
Do you want to continue(Y/N)? Y
How many rows/columns(5-21)? 55
Invalid number. Range 5 - 21. Enter again: 5
0****
*0***
**0**
***0*
****0
Do you want to continue(Y/N)? N
This is the code I've been playing around around with. Anyone know what needs to be changed I'm stumped! lol
Code:#include <iostream> #include <iomanip> using namespace std; int main() { int factorial = 0; int held_Num = 0; char answer = 'y'; int i = 0; int m = 0; char star = '*'; while (answer == 'y') { cout << "Please enter a number to work with: " << endl; cin >> held_Num; while (held_Num < 5 || held_Num > 21) { cout << "Please enter a number to work with: " << endl; cin >> held_Num; } for (i = 1; i <= held_Num; i++) { cout << star << endl; for (m = 1; m <= held_Num; m++) { cout << star; } } cout << endl; cout << "Would you like to continue? (y/n): " <<endl; cin >> answer; } return 0; std::cin.get(); }//END OF MAIN