0

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++;)
}

3
Contributors
6
Replies
7
Views
6 Years
Discussion Span
Last Post by ikiag
0

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

0

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....

0

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

0

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.

Edited by myk45: n/a

0

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

Edited by Reverend Jim: Fixed formatting

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.