Click here to Skip to main content
16,006,341 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralVisual Studio and Custom File Types Pin
Dangleberry18-Sep-03 23:25
sussDangleberry18-Sep-03 23:25 
GeneralRe: Visual Studio and Custom File Types Pin
Dangleberry19-Sep-03 1:12
sussDangleberry19-Sep-03 1:12 
GeneralVisual Studio 6 : bsc file Pin
Jerome Conus18-Sep-03 22:42
Jerome Conus18-Sep-03 22:42 
GeneralRe: Visual Studio 6 : bsc file Pin
David Crow19-Sep-03 2:09
David Crow19-Sep-03 2:09 
Generalhelp with while and for. Pin
kh.pakdaman18-Sep-03 20:35
kh.pakdaman18-Sep-03 20:35 
GeneralRe: help with while and for. Pin
Michael P Butler18-Sep-03 22:25
Michael P Butler18-Sep-03 22:25 
GeneralRe: help with while and for. Pin
RChin18-Sep-03 23:06
RChin18-Sep-03 23:06 
GeneralRe: help with while and for. Pin
Larry J. Siddens19-Sep-03 2:59
Larry J. Siddens19-Sep-03 2:59 
Don't mind me, I'm in a teaching mood!

There are three diffrent looping structures within The C Programming Language and C++ (an extension of C). There are:


  1. for
  2. while
  3. do-while


Here is a brief description for each:


  1. for: The for loop is mainly used to step through something, like an array. It syntax is "for( staring index ; condition ; increment ) Statement" These statements can be incremented (or decremented) by a known value, like 1, 3, 5, 56, ... You don't need all the items within the paranthesis, but you do need the semi-colons. Example:
    for( x = 0; x < 10; x++ ) a[x] = x;
    for( ;; )...
    Here I have an endless loop.
    for( ; x < 10; ) ...
    Here it is like the while loop.
  2. while The while loop is used to do looping until a condition is met. One example for the while would be in polling something. You continue waiting until the event occurs then drop out of the loop. You can interchange the for/while exactly like one of the post stated. The condition testing is done at the beginning of the loop.
  3. do-while This loop structure is a different animal than the rest. Unlike the for/while loops where they must first pass the condition to execute, the do-while will always execute the loop once. The condition testing is done at the end of the loop instead of the beginning.


I hope this helps. The uses that I described are not hard and fast, but they can be used as a guide line if your new until you get more experience.

Larry J. Siddens
Cornerstone Communications

TAME THE DOCUMENT MONSTER
www.unifier.biz
GeneralRe: help with while and for. Pin
bhangie19-Sep-03 4:27
bhangie19-Sep-03 4:27 
GeneralCatch message from the balloon help Pin
Eugene Pustovoyt18-Sep-03 20:12
Eugene Pustovoyt18-Sep-03 20:12 
Generalproblem with Dialog based application Pin
Ph@ntom18-Sep-03 20:08
Ph@ntom18-Sep-03 20:08 
GeneralProfUIS library Pin
Haldir18-Sep-03 16:39
Haldir18-Sep-03 16:39 
GeneralRe: ProfUIS library Pin
Michael P Butler18-Sep-03 22:28
Michael P Butler18-Sep-03 22:28 
GeneralUsing SDI with Formviews Pin
Mike Danberg18-Sep-03 15:44
Mike Danberg18-Sep-03 15:44 
GeneralRe: Using SDI with Formviews Pin
Steve S18-Sep-03 21:47
Steve S18-Sep-03 21:47 
GeneralRe: Using SDI with Formviews Pin
Michael P Butler18-Sep-03 22:35
Michael P Butler18-Sep-03 22:35 
GeneralRe: Using SDI with Formviews Pin
Mike Danberg19-Sep-03 15:59
Mike Danberg19-Sep-03 15:59 
GeneralRe: Using SDI with Formviews Pin
Mike Danberg19-Sep-03 20:39
Mike Danberg19-Sep-03 20:39 
GeneralImplement scale view Pin
TianYang18-Sep-03 15:31
TianYang18-Sep-03 15:31 
GeneralRe: Implement scale view Pin
imsniper18-Sep-03 20:59
imsniper18-Sep-03 20:59 
QuestionI/O Question ????? Pin
e010190718-Sep-03 14:08
e010190718-Sep-03 14:08 
AnswerRe: I/O Question ????? Pin
e010190718-Sep-03 14:12
e010190718-Sep-03 14:12 
AnswerRe: I/O Question ????? Pin
David Crow19-Sep-03 2:19
David Crow19-Sep-03 2:19 
GeneralUI Thread question... Pin
RobJones18-Sep-03 12:34
RobJones18-Sep-03 12:34 
GeneralRe: UI Thread question... Pin
Stefan Pedersen18-Sep-03 13:03
Stefan Pedersen18-Sep-03 13:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.