How do you read a input file into a structure in c++?

Say for example you have an input file with 5 names. And a structure such as

struct{

string student;
int grade;
};

The input file is structured like:

Justin Williams 95
Tracy Williams 34

How do I get the names and the respective grade into the structure?

Thanks.

If you had

string studentName;
int grade

not in a structure, how would you do it?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.