fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void display(string student, int marks[5]);
  5.  
  6. int main() {
  7. string students[10] = {"Bob", "Jerry", "Mary", "Michael", "Brian", "Emma", "Sean", "Declan", "Ken", "Daniel"};
  8.  
  9. int marks[10][5] = {{60, 87, 54, 98, 87},
  10. {70, 69, 65, 98, 87},
  11. {83, 64, 92, 98, 87},
  12. {58, 45, 25, 98, 87},
  13. {87, 19, 67, 98, 87},
  14. {97, 74, 32, 98, 87},
  15. {41, 77, 96, 98, 87},
  16. {14, 78, 24, 98, 87},
  17. {32, 98, 78, 98, 87},
  18. {38, 97, 88, 98, 87}
  19. };
  20.  
  21. cout << "Displaying marks: " << endl;
  22.  
  23. for (int i = 0; i < 10; ++i) {
  24. display(students[i], marks[i]);
  25. }
  26. return 0;
  27. }
  28.  
  29. void display(string student, int marks[5])
  30. {
  31. cout << "Student: " << student << " " << marks[0];
  32. for (int j = 1; j < 5; ++j) {
  33. cout << ", " << marks[j];
  34. }
  35. cout << endl;
  36. }
Success #stdin #stdout 0s 4520KB
stdin
Standard input is empty
stdout
Displaying marks: 
Student: Bob 60, 87, 54, 98, 87
Student: Jerry 70, 69, 65, 98, 87
Student: Mary 83, 64, 92, 98, 87
Student: Michael 58, 45, 25, 98, 87
Student: Brian 87, 19, 67, 98, 87
Student: Emma 97, 74, 32, 98, 87
Student: Sean 41, 77, 96, 98, 87
Student: Declan 14, 78, 24, 98, 87
Student: Ken 32, 98, 78, 98, 87
Student: Daniel 38, 97, 88, 98, 87