Hi there, just made this little application(but borrowed some code from another classmate) which prints the following:
Code:
5*5*5*5*5
4*4*4*4
3*3*3
2*2
1
Here is the code:
Code:
#include<iostream>
using namespace std;
int main()
{
int iNum1 = 6;
int iNum2 = 5;
char cStar = '*';
do
{
for (int x=1;x<iNum2;x++)
{
cout << iNum2 << cStar;
}
cout << iNum2;
iNum2--; iNum1--;
cout << endl;
} while(iNum1>1);
cin.get();
return 0;
}
Im just wondering how i could possibly optimize this code, and also would like your thoughts about the code, whatever it may be, some hints or pointers about anything of this code which i should take into consideration in fututre, thanks.