Hi guys, so I am stuck with a problem on creating a program whose input is a single integer, which will create a file containing a "square" of that size with alternating symbols i.e * and +, so if user enter 3, then the output would be 3rows and 3 columns of alternating * and + while is empty inside the box.
I have a program, but i need help to make it compile well.
using namespace std;
cout << "How many columns by row do you want to create? " <<endl;
cin >> n;
cout << "Enter a file to be opened for input: ";
cin >> inFilename;
if(inFile.fail()) //file does not exist
cout << inFilename << " does not exist. Please check it is in the appropriate folder.\n";
for(int i = 0; i < n; ++i)
for (int j = 0; j < n; ++j)
cout << "* ";
if ( i = row)
cout << i = 1 && i = n << "i= * "<< endl;
cout << " " << endl;
Lines 14-25: What's with opening inFile? You don't use it. The problem statement does not say anything about reading from a file.
Line 32: = is the assignment operator, not the equality operator. row is not defined.
Line 33: Why do you have the && operator in your cout statement?
Line 37: = is the assignment operator, not the equality operator. column is not defined.
Line 38: Why do you have the && operator in your cout statement?
Line 42: = is the assignment operator, not the equality operator. even is not defined.
PLEASE USE CODE TAGS (the <> formatting button) when posting code. It makes it easier to help you.