BrainDump
  Home arrow BrainDump arrow Page 2 - C:Loops
Iron Speed
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Dedicated Servers 
Download TestComplete 
Windows Web Hosting
 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
IBM Developerworks
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
BRAINDUMP

C:Loops
By: James Payne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2008-03-17

    Table of Contents:
  • C:Loops
  • While You Were Away
  • Do it While You Can
  • The Break And Continue Statement

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    Iron Speed
     
    ADVERTISEMENT

    Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!

    C:Loops - While You Were Away
    (Page 2 of 4 )

    While loops work by saying: while this is true, keep repeating through the loop. Let's look at a program to print some text:


    #include <stdio.h>

    int main()

    {

    int count;

    count= 0;

    while (count<10)

    {

    printf("Look a loop!n");

    count++;

    }

    return(0);

    }

    This program will print the following:

      Look a loop!

      Look a loop!

      Look a loop!

      Look a loop!

      Look a loop!

      Look a loop!

      Look a loop!

      Look a loop!

      Look a loop!

      Look a loop!

    Let's try something else. Change the value of count to 11 and run the program again.

    Nothing happens, right? This is because the loop only executes while the criteria is true.

    Otherwise it won't execute at all.

    To fix this, if it indeed needs fixing, we can create a Do While loop.

    More BrainDump Articles
    More By James Payne


       · Hey, welcome to my article on C Loops. where we discuss the different types of loops...
     

    BRAINDUMP ARTICLES

    - Multiple Service Contracts and Indigo
    - Cleaning Out Your Programs in XP
    - Handling Metadata with Indigo
    - Building Blocks for a WCF Service Web Site
    - Help! I Need Some Remote Assistance
    - Using Service Templates with Indigo
    - Windows XP Tips for Task Manager
    - Generating Clients and Services with Indigo
    - Vista SP1, A Review
    - Services and the WCF
    - VBScript: Final Date Functions
    - Creating Services with the WCF
    - The Resource View of the MFC
    - VBScript: More Fun with the Date Functions
    - Vista Price Cuts Dissected




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway