Hi all,
im a total noob having to take C++ as part of my design course please help me!
Start with this code:
Code:
#include <iostream>
using namespace std;
int main()
{
int x = 5;
for ( int r = 0; r < x; r++ )
{
for ( int c = 0; c < x; c++ )
{
if ( c == 0 || c == x - 1 || r == 0 || r == x - 1)
cout << "*";
else
cout << " ";
}// inner for
cout << endl;
}// outer for
}
(b) Using while loop, modify the program in Table 1.
(c) You noted that the value of x is hard-coded and the program in Table 1 executes only once. Amend the program in Part (b) to allow data entry for the variable x and repeats the execution until the user enters the sentinel value, -1 to exit the program. Comment your code for this Part (c).
Please help me with the code guys i would really appreciate it