If i want to print a grid of letters..for example

AAAAA
BBBBB
AAAAA
BBBBB
AAAAA

this is what I got so far. need some clues as to how I should approach the problem?

#include <iostream>
using namespace std;

int main ()
{
    int n;
    cout << endl << "Enter a positive integer: ";
    cin >> n;
    while (n < 0)
    {
        exit (1);
    }
    for (int r = 1; r <= n; r++)
    {
        for (int c = 1; c <= n; c++)
        {
            if      (r == 1)    cout << "A";
            else if (c == 1)    cout << "B";
            else                cout << " ";
        }
        cout << endl;
    }
    return 0;
}

this is what i get as output

Enter a positive integer: 4
AAAA
B
B
B

solved!

#include <iostream>
using namespace std;

int main ()
{
    int n;
    cout << endl << "Enter a positive integer: ";
    cin >> n;
    while (n < 0)
    {
        exit (1);
    }
    for (int r = 1; r <= n; r++)
    {
        for (int c = 1; c <= n; c++)
        {
            if      (r % 2 != 0)    cout << "A";
            else if (r % 2 == 0)    cout << "B";
            else                    cout << "?";
        }
        cout << endl;
    }
    return 0;
}
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.