I used code to create that littl box for the code to go into, but if it doesnt work then ill try again Ive used both cin.get() and system("pause") to let the program run while keeping the window open. In both cases the program runs one line and then stops. I dont understand why their stopping the program. Im using a dev compiler. thanks Code: #include<iostream> using namespace std; int main() { int counter; for(counter=1; counter < 101; counter++); cout << "is this working" <<endl; cin.get(); return 0; }
You're not clear. Runs one line? Which line? What do you mean, stops? Your for loop does nothing but count. That's an invisibly short delay. Is the cout working?
when I run the progra,, it prints "is this working" , just one time. below that it says please press any key to continue, when I hit the enter button the whole screen disapears. Its suppose to print out "is this working 100 times because the counter is set at 1. But it doesn't I checked the counter, cout, the loop and the whole program and cant find a flaw. Yet it doesnt work
You have a semicolon after the for loop which means the cout statement is not within the loop but outside the loop.