-1

I have to make the letters "T" "O" and "L" using asterisk in c++. The code asks for a size and the letter. This is what I have so far. Honestly I a not great with loops at all, how do i make the loops? some step by step explanation would be appreciated as well. Thanks a ton. Here is my code.

    #include<iostream>
    using namespace std;
int main()
{
    char T, O, L;
    char letter;
    int number, size;
    size = number % 2;

    cout << "Welcome to the letter printer." << endl;
    cout << "Enter the size : " << endl;
    cin >> size;

    while (size <= 5 || size == 0)
    {

        cout << "Invalid size. Enter the size again: ";
        cin >> size;
    }

    cout << "Enter the letter: " << endl;
    cin >> letter;

    while (letter != 'T' && letter != 'O' && letter != 'L')
    {
        cout << "Invalid Letter. Enter the letter again:";
        cin >> letter;
        {


            while (letter == 'T')
            {
                for (int i = 0; i < size; i++)
                {
                    for (int j = 0; j < size; j++)
                    {
                        cout << "*";
                    }
                    cout << endl;
                }
            }
        }

    }

1 Answers1

3

We're not here to solve your homework for you. Your question way too open ended with no actual issue other then "idk how to do this please do it for me". If I had to recommend some steps i'd say draw out each letter in a txt file using asterisks. Then figure out which parts you're going to have to loop for and which parts your going to have to just print out.

For example the T. I would solve it by first printing a line of asterisks for the top of the T. Then make a loop that prints out a single asterick with white space on each side for as many times as you feel you should to make the base of the T.

Kilbo
  • 333
  • 1
  • 12
  • I'm not asking for you guys to solve it, just for some guidance. That second paragraph really helped me. Appreciate you a ton. – Walton Charles Oct 12 '17 at 00:47
  • The L is similiarlly easy, one asterick with x amount of whitespace followed by a line of asterisks at the bottom. The O is on you – Kilbo Oct 12 '17 at 00:50
  • If you could write a code example that would be great as well. Id greatly appreciate it. – Walton Charles Oct 12 '17 at 00:51