akela43

структура students

Jan 7th, 2021
744
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1.  
  2. #include <iostream>
  3. #include <string>
  4. struct Student {
  5.     std::string name;
  6.     uint group;
  7.     uint points[5];
  8. };
  9. int main()
  10. {
  11.     // массив
  12.     Student students[10];
  13.    
  14.     // ввод в массив
  15.      for(Student &s: students) {
  16.         std::cin >> s.name >> s.group;
  17.         for (uint & point: s.points) std::cin >> point;
  18.     }
  19.     // вывод массива
  20.     for(const Student &s: students) {
  21.         std::cout << s.name << " " << s.group;
  22.         for (const uint point: s.points) std::cout << point << " ";
  23.         std::cout << '\n';
  24.     }
  25.    
  26. }
Advertisement
Add Comment
Please, Sign In to add comment