delorie.com/archives/browse.cgi | search |
From: | "Taylor MacDonald" <macdonaldtaylor AT hotmail DOT com> |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | for loop |
Lines: | 57 |
X-Priority: | 3 |
X-MSMail-Priority: | Normal |
X-Newsreader: | Microsoft Outlook Express 5.50.4133.2400 |
X-MimeOLE: | Produced By Microsoft MimeOLE V5.50.4133.2400 |
Message-ID: | <EuJf6.247$GB3.58858@sapphire.mtt.net> |
Date: | Tue, 06 Feb 2001 02:40:36 GMT |
NNTP-Posting-Host: | 142.177.228.4 |
X-Complaints-To: | abuse AT mpoweredpc DOT net |
X-Trace: | sapphire.mtt.net 981427236 142.177.228.4 (Mon, 05 Feb 2001 22:40:36 AST) |
NNTP-Posting-Date: | Mon, 05 Feb 2001 22:40:36 AST |
Organization: | MPowered-Subscriber |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Reply-To: | djgpp AT delorie DOT com |
I created this program will the help of some of my friends and now I need to analysis it. Would someone please tell me how all of these for loops work. How can I explain the output and how the output is determined? #include <iostream.h> #include <conio.h> #include <iomanip.h> int main() { clrscr(); // for loop 1 for (int x =0; x <10 ; x++) cout <<setw(3) << x; cout << endl; // for loop 2 for (int y = 1; y <= 10; y += 2) cout << setw(3) << y; cout << endl; // for loop 3 for (int z =10; z > 0; z --) cout << setw (3) << z; cout << endl; // for loop 4 for (int a =10; a < 0; a++) cout << setw(3) << a; cout << endl; getch(); return 0; }
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |