qasdas

closed account (3UMLy60M)
asdqawda
Last edited on
add my if statement to your for loop. I think that will solve it.

also, open your outputFile.open("Printout.txt") before the for loop and:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
for (int i = 0; i < rows; i++)
	{
		for (int j = 0; j < columns; j++)
		{
            if(i%2 == 0)
                     {
			cout << 0;
                        outputFile << 0;
                      }
			else
                        {
			cout << 1;
                        outputFile << 1;
                        }
		}
		cout << endl;
                outputFile << endl;
	}
Last edited on
closed account (3UMLy60M)
atriumheart,

Thank you so much! Your for loop was exactly what I needed. The last thing I need to do is print my program output to a text file. Does anybody know how I would be able to do this?
i edited my original post. It now fixes both of your problems.
Last edited on
closed account (3UMLy60M)
Thanks man, you're a hero. I just realized that instead of reading:
5
7


The original text file should contain the two numbers next to each other:
5 7


What changes would I need to make in order for the program to still work?

Sorry for all the questions.
Last edited on
no space in between the numbers?
closed account (3UMLy60M)
The numbers are separated by one space.
if there is a space between the numbers, then that shouldn't change a thing. If it was simply "57", then we would have to change some things.
Topic archived. No new replies allowed.