Kod: Zaznacz cały
// processing_two_dimensional_array.cpp : main project file.
#include "stdafx.h"
#include <iostream>
using namespace std;
const int NUMBER_OF_ROWS=5;
const int NUMBER_OF_COLUMNS=6;
void enterValues ( int matrix[NUMBER_OF_ROWS][NUMBER_OF_COLUMNS]);
void printMatrix ( int matrix[NUMBER_OF_ROWS][NUMBER_OF_COLUMNS]);
int main()
{
cout<<"Program prints the 2D matrix , sums rows and finds the largest element in each row";
int board [NUMBER_OF_ROWS][NUMBER_OF_COLUMNS];
enterValues (board);
cout<<endl;
printMatrix( board );
cout<<endl;
cout<<endl;
system("PAUSE");
}
void enterValues ( int matrix[NUMBER_OF_ROWS][NUMBER_OF_COLUMNS] )
{
int col;
int row=0;
for (col=0 ; col <= NUMBER_OF_COLUMNS ; col++)
for ( row = 0 ; row <= NUMBER_OF_ROWS ; row++)
cin >> matrix[row,col];
}
void printMatrix ( int matrix[NUMBER_OF_ROWS][NUMBER_OF_COLUMNS])
{
int col;
int row=0;
for (col=0 ; col <= NUMBER_OF_COLUMNS ; col++)
for ( row = 0 ; row <= NUMBER_OF_ROWS ; row++)
cout << matrix[row,col];
}
W programie chodzi o to, żeby użytkownik wypełnił statyczną tablicę dwuwymiarową która zaraz po tym wyświetli się na ekranie. Po skompilowaniu wyskakuje
czego za bardzo nie rozumiem.1>processing_two_dimensional_array.cpp(39): error C2678: binary '>>' : no operator found which takes a left-hand operand of type 'std::istream' (or there is no acceptable conversion)