I am trying to get the data from this file and add it to my constructor. I am doing something wrong, I understand, but I need the correction. Specifically, in my get grade function how do I set the class objects to the data within the file:
The file data is:
Mary Smith 10  5  8  10  6  2  10
Ken Lewis 5  3  2  10  8  9  10
My code:
#include <iostream>
#include <string>
#include <fstream>
#include <iomanip>
using namespace std;
void get_grade();
//void compute_grade();
class Student
{
  public :
  string firstname;
  string lastname;
  int lab1;
  int lab2;
  int lab3;
  int lab4;
  int lab5;
  int lab6;
  int lab7;
  Student(string a, string b, int c, int d, int e, int f, int g, int h){
    firstname = a;
    lastname = b;
    lab1 = c;
    lab2 = d;
    lab3 = e;
    lab4 = f;
    lab5 = g;
    lab7 = h;
  }
};
int main()
{
  get_grade();
}
void get_grade()
{
//Student stud2();
ifstream myfile; 
myfile.open("infile.txt");
myfile >> stud1.firstname; 
cout << stud1.firstname;
}
 
    