Write a function arraylist which receives an array of integer values. The list of elements are
the following:
20, 40, 60, 80
50, 90, 70, 10
30, 100, 200, 300
#include <iostream>
using namespace std;
int main() {
const int line = 3;
const int col = 4;
int array[line][col] = {};
int i,j;
cout << "Enter twelve numbers:\n";
for( i=0; i<line; ++i) {
for( j=0; j<col; ++j) {
cin >> array[i][j];
if(!cin) {
cout << "Bad input\n";
return 1;
}
}
}
for( i=0; i<line; ++i) {
for( j=0; j<col; ++j) {
cout<<array[i][j]<<' ';
}
cout<<endl;
}
return 0;
}
Comments
Leave a comment