when programming while loops, you'll often find yourself going through three steps; setting up a starting condition, testing to see whether it worked, and incrementing an other wise changing variable.eg:
#include<iostream>
int main()
{
int counter = 0;
while(counter>5)
{
counter++;
std::cout<<"Looping! ";
}
std::cout<<"\nCounter: "<<counter<<std::endl;
return 0;
}
No comments:
Post a Comment