Jun 7, 2012 at 11:01am UTC
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
#include <iostream>
using namespace std;
int main()
{
int i, j, k,a;
a=9;
for (i=0; i<=a; i+=2)
{
for (j=0; j<a-i; j+=2)
{
cout<<" " ;
}
for (k=0; k<=i; k++)
{
cout<<"*" ;
}
cout<<endl;
}
a=a-2;
for (i=0; i<a; i+=2)
{
for (j=0; j<=i+2; j+=2)
{
cout<<" " ;
}
for (k=1; k<=a-i;k++)
{
cout<<"*" ;
}
cout<<endl;
}
return 0;
}
program is without color. I need help to create a different color in each row. give me a bit of learning to solve.
thanks for the replies.
Last edited on Jun 7, 2012 at 11:05am UTC
Jun 7, 2012 at 11:03am UTC
C++ does not understand colour. It does not understand what a monitor even is. If you want colour in the output, it depends entirely on your operating system and the console program you are using to display the output.
What is your operating system?
Jun 7, 2012 at 11:16am UTC
@Moschops
I use windows xp.
Jun 7, 2012 at 11:20am UTC
@Moschops
I just want a little extra code in the above program so that the output has a different color in each row