MATRIX


int row = 0, col = 0, counter = 0;
const int maximumSize = 10;
int A[maximumSize][maximumSize];

while(row <= counter){
col=0;
while( cin.peek() not_eq '\n' ){
cin >> A[row][col];
++col;
counter = col;
}
++row;
cin.ignore();
}

with this code i cannot do the following task:

A program that will input an n-by-n matrix A by rows from the keyboard in the following way. Each line should input a row of the matrix where (i) one or more spaces separates each row entry and (ii) a return character follows the last digit of the last entry of each row. size parameter for the matrix should be declared as
const int maximumSize = 10;
and the matrix should be declared as
float A[maximumSize][maximumSize];but the program should NOT prompt the user for the matrix size. The program should count how many columns the user enters before hitting "Enter" and how many rows.

Where did i mistake or how can ı do this? Somebody help!

NOTE: i think i can only include 'iostream'
Last edited on
Topic archived. No new replies allowed.