fork download
  1. #include <string>
  2. #include <vector>
  3. #include <iostream>
  4. struct Students
  5. {
  6. std::string Name;
  7. short testScore1, testScore2, testScore3;
  8. };
  9.  
  10. int main()
  11. {
  12. short num;
  13.  
  14. std::cout << "Enter # of students: ";
  15. std::cin >> num;
  16.  
  17. std::vector<Students> worms(num);
  18.  
  19. // ... rest of code
  20. std::cout << "the are " << worms.size() << " students in the container\n";
  21. }
Success #stdin #stdout 0.02s 2860KB
stdin
10
stdout
Enter # of students: the are 10 students in the container