English version
German version
Spanish version
French version
Italian version
Portuguese / Brazilian version
Dutch version
Greek version
Russian version
Japanese version
Korean version
Simplified Chinese version
Traditional Chinese version
Hindi version
Czech version
Slovak version
Bulgarian version
 

C++ tutorials: 3, program flow (if, else, while, for)

Software RSS Feed





Program Flow is what you think it is. How the program will flow. As you know the compiler will just go down the code. Program flow is what you use to make it run a certain thing a few times, do something based on a variable, etc... There are some basic comands to program flow. The first two are loops: While and For. When you want something to loop for an amount of times based on a variable, use while. If you know how many times you want something to run, use for. If and else statements are pretty self explanable. Dont be afraid, I will go over all the syntaxes and how to do everything!

The For Loophttp://www.syschat.com Use a for loop when you know how many times you want something to run. For example, we want to have an application that counts from 0 to 50 and count by fives. To do this we would need a for loop. Here is how you do it:

for(DEFINE VARIABLE; WHEN IT SHOULD STOP; How much you count every time the program runs){

Code you want to run. } Ok, so with our 0-50 program, we would do the following:

for(int x = 0; x < 51; x=x+5){

cout

Article Source: Messaggiamo.Com





Related:

» Seo Elite: New Seo Software!
» AntiSpywareBOT
» Reverse Mobile
» Error Nuker


Webmaster Get Html Code
Add this article to your website now!

Webmaster Submit your Articles
No registration required! Fill in the form and your article is in the Messaggiamo.Com Directory!

Add to Google RSS Feed See our mobile site See our desktop site Follow us on Twitter!

Submit your articles to Messaggiamo.Com Directory

Categories


Copyright 2006-2011 Messaggiamo.Com - Site Map - Privacy - Webmaster submit your articles to Messaggiamo.Com Directory [0.01]
Hosting by webhosting24.com
Dedicated servers sponsored by server24.eu