You've got three problems, first off you mistyped the equality operator:
This:
Code:
if ( count = 5 ) // if count is 5,
Should be "==" for comparing two values:
Code:
if ( count == 5 ) // if count is 5,
Second, you're misusing the "break" operator. The "break" operator will completely exit the inner-most loop-- meaning that once it hits "5", the loop will no longer run.
What you're instead looking for is "continue", which will skip the rest of the current iteration of the loop but still finish out the loop.
Lastly, your loop will only iterate 9 times (1 through 9). To make it go 1 through 10, you should modify the second parameter of your for loop to read "count <= 10".
Final code (untested):
Code:
#include <iostream>
using std::cout;
using std::endl;
int main()
{
int count;
for ( count = 1; count <= 10; count++ ) // loop 10 times
{
if ( count == 5 ) // if count is 5,
continue; // skip remaining code in loop
cout << count << " ";
} // end for
cout << "Skipped printing 5" << endl;
return 0; // indicate successful termination
} // end main