|
From: Ioannis V. <no...@ya...> - 2001-07-19 19:50:55
|
#include <iostream>
int main()
{
using std::cout;
using std::endl;
for(int i=0; i<9; i++)
{
for(int j=9-i; j>0; j--)
cout<<'*';
cout<<endl;
}
}
Ioannis
* Ioannis Vranos
* Programming pages: http://www.noicys.f2s.com
<http://www.noicys.f2s.com/>
* Alternative URL: http://run.to/noicys
-----Original Message-----
From: dev...@li...
[mailto:dev...@li...] On Behalf Of
Tre...@ao...
Sent: Thursday, July 19, 2001 7:35 PM
To: dev...@li...
Subject: [Dev-C++] nested loop
I have to write a program that uses a nested while loop in order to
display
lines of asterisks from 9 to 1. Here is the code.....can anyone help
me? I
don't understand how to make this work.
#include<iostream>
int main()
{
int asterisk = 9;
int counter = 9;
char ast = '*';
asterisk = (asterisk * ast);
while (counter > 0)
{
cout << asterisk << endl;
counter = counter - 1;
asterisk = asterisk - ast;
while (asterisk > 0)
{
cout << "*" << "" << endl;
}
}
return 0;
}
|