Header HomeContact
.


Specializing in removing viruses, reinstalling operating system on laptop, desktop, network. Installing software, applications, utilities, antivirus, repair. Serve Atlanta, Mcdonough, Ellenwood, Stockbridge, college park. Professional computer technician.

 

 

C++ Code

While Loop

#include <iostream>

#include<string>

int main ()

{

using namespace std;

int x=1;

while (x<=10)

{

cout << x << endl;

x = x+1;

}

system ("pause");

return 0;

}

 

While Loop:

This loop will start from 1 and loop to 10 then stop (1, 2, 3, 4, 5, 6, 7, 8, 9, 10). The statement says while (x<=10), it will not go further than ten.

You can change the (cout << x << endl;) statement. Replace x with "Hello World" noticed the quotation marks? You need to include it in the cout statement.

Go to Do While Loop