welcome aboard! I'm pretty new myself, and already battling mystical shit and erratic compiler reactions! And I know how to set up a repeating message...
to print these out a billion times, you have to create a for loop first. Looks like this:
1 2 3 4 5 6 7 8 9 10
|
using namespace std;
int print = 0;
int main()
{
for(print == 0; print < 10; print++)
cout << "message message message\n";
}
|
Here is the basic breakdown:
print == 0; checks if the value print is set to 0, that's the first conditional part of the for loop.
If that's not met, the loop will not start.
print < 10; will check if the value of print is below 10, and is the second conditional part.
It will continue repeating the loop, until it reaches that point, and stop.
print++; will keep increasing the value of print by 1 each time the loop has run through it's own code. This is what the conditions are mainly for, and stops the loop from literally running a billion times.
I can also show you how to mix "text" with values. Here is one way, using this exact loop:
1 2 3 4 5 6 7 8 9 10
|
using namespace std;
int print = 0;
int result = 2000;
int main()
{
for(print == 0; print < 10; print++)
cout << "Aaaaand the result is: " << result << "!\n";
}
|
I added in int result = 2000, and ordered the program to print out the value of result. You can create a giant congo-line of text and values and whatnot, cout will print it all out without discrimination, one right after the other. Just remember using the << arrows, because you can't mix raw values and "text" together, you have to seperate it with the <<.
Oh, and it must always point to cout <<.
And lastly, and that's just my opinion, you got to make ULTRALIBERAL use of "\n", it's pure bueno for the eyes and makes everything a lot easier to decipher.