The 'for' loop with C++

Published on: June 3, 2010

This video tutorials shows you how the "for" loop in C++ works and even though it's not the best tutorial for the "for" loop, it will work serve the purpose in explaining how it works. If you are confused in any way about any part of the tutorial, let me know and I'll be happy to clear things up with you. Please note that it uses the Yard to Feet conversion tutorial to demonstrate how the "for" loop works. Thanks for watching and thanks for your support!

Remember to checkout the Codesnip below to review the C++ code yourself! Feel free to copy the code, but I ask that you please provide credit if you leave the code unchanged when you use it.

Codesnip:

//Programmer: Nazmus
//Program:  Yard to Feet conversion
//Website:  EasyProgramming.net

#include <iostream>;
using namespace std;

void main()
{

 int yard, feet, i;

 for(i=1;i<=3;i=i+1){

 cout << "Please input number of yards: ";
 cin >> yard;

 feet = yard * 3;

 cout << yard << " yards equal to " << feet << " feet." << endl;

 }

 system("pause");

}



Comments: