well im doing a program that should output:
A
BB
CCC
DDD
EEEE
FFFFF

using 2 loops.

im on Dev-C++ 4.9.9.2

im all new 2 this
an this is what i got so far, some help will b great to finish this =]

#include<iostream>
  #include<iomanip>
  
using namespace std;

int main()
{
    unsigned int cLetter=++;
}

for (int x=1; x<=4; ++x)
    {
        for(int y=1; y<=12; ++y)
        cout<<setw(5) <<y*x<<endl;
        }
        getchar();
        return 0;
        }

1) Welcome to Daniweb! Please take a moment to read the anouncement at the top of the board about using code tags when posting code. The code tags will help preserve the indentation you should be using when writing your code when you post to the board.

2) You program stops after the last line posted here. I'm sure that's not what you want.

int main()
{
   unsigned int cLetter=++;
}

3) Try this out:

#include <iostream> 
using namespace std;
int main()
{
   char ch = 'a';
   cout << ch << endl;;
   ch++;
   cout << ch << endl;
   return 0;
}

3) The first loop should control what line you are on and what char is output. The second loop should control how many times you output the char on that line.

cool thanks, but it doesnt stay on the screen.
getchar() doesnt work

oopz it does work, thanks. now i have 2 try get the rest of the letters up

cool thanks, but it doesnt stay on the screen.
getchar() doesnt work

http://www.dreamincode.net/forums/showtopic30581.htm

You can try cin.get () instead of getchar.

#include <iostream>
using namespace std;

int main ()
{
    char ch = 'a';
    cout << ch << endl;;
    ch++;
    cout << ch << endl;      
    cin.get ();        
    return 0;
}

cool now it shows up as:
A
B


any ideas on how to double how many letters appear eg)
A
BB

cool now it shows up as:
A
B


any ideas on how to double how many letters appear eg)
A
BB

You need a nested for loop (a for loop inside of a for loop:

for (int i = ?; ?; ?)
{
     // code
     for (int j = ?; ?; ?)
     {
         // code
     }
     // code
}

Make sure to post your updated code.

See the last comment in my first post.

sorry the code i now have is:

#include <iostream>
using namespace std;
int main()
{
char cLetter = 'A';
cout << cLetter++<< endl;
cLetter;
cout << cLetter<< endl;
getchar();
return 0;
}

i cant seem to do this:
A
BB
CCC
DDDD
EEEEE
FFFFFF

Where are the loops?

Here's one way to progress to the answer without jumping in head first:
Write a program that writes 4 As to a line using a loop.
Then write a program that writes 4 As to each of 3 lines usng a nested loop (one loop inside the other-----you have one of these in the first post you made in this thread).
Then write a program that writes 1 A to the first line, 2 As to the second line and 3 As to the third line.
Then write a program that writes 1 A to the first line, 2 Bs to the second line, 3 Cs to the third line, 4 Ds to fourth line, etc.
Then write a program that can allow for user input to determine how many lines will be used, up to say....maybe 26 lines.

If you have trouble expanding on each any of the versions, then post what you have.

commented: Good approach +8

i have looked on other websites about loops and loops just confuse me =[

i did that an like i cant get past the
A
BB

heres the code i got now:
#include <iostream>
using namespace std;
int main()
{
char cLetter = 'A';
do{
cout << cLetter++<<endl;
cLetter;
cout << cLetter <<cLetter++<<endl;
}
while (cLetter>=2);

getchar();
return 0;
}

Loops have to be controlled by something. That is, they need to know when to stop, otherwise they just keep going. while(cLetter >= 2) will just keep going and going and going, because the integer value of cLetter will never be less than 2.

A common technique to do want you want is to use for() loops. You use for loops in your first post, and your syntax is correct; you have an initial value, a condition on when to stop, and what to change each time through the loop. Therefore, I assume you have pretty good knowledge about how to use them. I will write a program to write 4 As to the screen one one line. I want you to compile run and confirm that that is what it does. Then I want you to modify the program to print 3 lines of 4 As to the screens by enclosing the original for loop inside another for loop.

#include <iostream>
using namespace std;

int main()
{
   int numberOfCharToPrint = 4;
   char ch = 'A';
   //This loop controls the number of time ch is printed to the screen, all on one line
   for(int i = 0; i < numberOfCharToPrint; ++i)
   {
       cout << ch;
   }
   //go to next line
   cout << endl;
   
   cin.get();
   return 0;
}

thanks for the help =]

the program is working i used the code:

#include <iostream>
using namespace std;
int main()
{    
     char cLetter=0;
     while (cLetter<6)
     break;
      {
           while (cLetter++)
           break;
            {   
                cout<<"A\nBB\nCCC\nDDDD\nEEEEE\nFFFFFF";
            }
           cout<<endl;
      }
     getchar();
     return 0;
}

well im doing a program that should output:
A
BB
CCC
DDD
EEEE
FFFFF

using 2 loops.

im on Dev-C++ 4.9.9.2

im all new 2 this
an this is what i got so far, some help will b great to finish this =]

#include<iostream>
  #include<iomanip>
  
using namespace std;

int main()
{
    unsigned int cLetter=++;
}

for (int x=1; x<=4; ++x)
    {
        for(int y=1; y<=12; ++y)
        cout<<setw(5) <<y*x<<endl;
        }
        getchar();
        return 0;
        }

Hey There !

Friend From My Point Of View "PROGRAMMING IS NOT JUST WRITING THE PROGRAM STATEMENTS ... BUT INSTEAD PROGRAMMING IS DEVELOPING THE LOGIC FIRST THEN TRANSFORMING THE LOGIC INTO THE PROGRAM" ....

THEREFORE .... FIRST CONCENTRATE ON THE PROGRAM LOGIC ... THEN TRY TO TRANSFORM THE LOGIC INTO THE PROGRAM STATEMENTS........

Further Help Contact Me: mujash.specialist@gmail.com

REGARDS:
MUJASH

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.