Monday, May 24, 2010

I need help with C++ programming.?

I need to draw a right-angled triangle filled with letters.


The output should look like this:


a


bc


def


ghij


klmno


e.t.c


I can do it with number but it's not working with letters. I don't no why. Can any one help me, please...

I need help with C++ programming.?
There is nearly no difference in C++ between a char and an integer which means you can do arithmetic with characters


I mean 'A' +1 ='B'


knowing that is it easy: you use a variable (let's call it "c") to store the letter you print and each time you print a letter you do a "c++" to go to the next letter.





Example:


=======


#include %26lt;iostream%26gt;


using namespace std;








void main()


{


char c='A';





for(int i=0;i%26lt;7;i++)


{


for(int j=0;j%26lt;i;j++)


{


cout %26lt;%26lt;c;


c++;


}


cout%26lt;%26lt;endl;


}


}
Reply:Post the source code that you wrote ...

flowers gifts

No comments:

Post a Comment