how to announce a table in c++?

i know it goes with "for"


for (int i=0;i<10;i++;)
{for (int j=0;j<10;j++;)
}

Recommended Answers

All 6 Replies

Well by table, do you mean a 2D matrix? or a graphical table? with rows and columns? Please elaborate.

it is not like a table...but i must make series up and down(like a table)....i do not know if you will understand me....

i must make it as in the excel but there are not letters..in both series are numbers

Ok, here is an example:

for (int i = 0; i < 10; i++) {
    for (int j = 0; j < 10; j++) {
        cout << "Hello ";
    }
    cout << endl;
}
prints hello in the format what you needed.

hello hello hello hello...
hello hello hello hello...
.
.
.
10 rows by 10 columns

Instead of hello, you can print the numbers.

to further add to that i and j can also be defined as variables and can be virtually any integer you want it to be

you can also input to it from a file or use user input

for(int i=0; i<variable; i++)
   {
       for(int j=0; j<variable2; j++)
           {
              cin >> someValue;
              cin >> someArray[i][j] = someValue
           }
    }

then output in the described manner above

yes....that is right...thank you very much

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.