Need help with next step of my project

I'm making a for loop in order to allow the "teacher" to add information about the "student" until enter is pressed. I can't figure out where I will store what the user types in for name. Please help!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
 

#include <iostream>
#include <string>
#include <sstream>

struct Student
{
    std::string name;
    int age;
    double GPA;
    std::string graduationDate;
}

int main()
{
    std::list<Student> students;
    for (int i=0; i<=100; i++){
        std::cout<< "Please enter the name of the student, or enter nothing to exit loop."<<std::endl;
        std::cin>>
    }
}
Last edited on
Please help!
In each iteration of the loop you have to create a new Student object, store the name in its "name" attribute and then store the object in your list.
Topic archived. No new replies allowed.