Convert to user input


return 0;
}
Last edited on
#include<iostream>

using namespace std;

int main(){

int subject[2][3] = { {100,75,60}, {80,90,100} };


//Convert this in to user input:
for(int i=0; i < 2; i++){
for( int x = 0; x < 3; x++){
cin >> subject[i][x];
}
cout << "\n";
}
return 0;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
constexpr int no_subjects = 3;
int subject[2][no_subjects], no_entries;

std::cout << "How entries would you like to make?";
std::cin >> no_entries;

for (int i = 0; i < no_entries; i++) {

   std::cout << "\nEntry No." << i+1;

   for (int j = 0; j < no_subjects; j++) {

      std::cout << "\nSubject No." << j+1 << ": ";
      std::cin >> subject[i][j];
   }
} 
thankyou!!
OP's original post.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 How can I convert this to user input?

#include<iostream>

using namespace std;

int main(){

int subject[2][3] = { {100,75,60}, {80,90,100} };


//Convert this in to user input:
for(int i=0; i < 2; i++){
cout << "GRADES" << i+1 << endl;
for( int x = 0; x < 3; x++){
cout << subject[i][x] << " " ;
}
cout << "\n";
}
return 0;
}
Topic archived. No new replies allowed.