1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
#include<iostream>
#include<vector>
#include<sstream>
#include"header.h"
int main(){
//new vector for individual students
std::vector<Student> studentVector;
while (true){
std::cout << "students ";
std::string input, command, param1, param2, param3, param4, param5;
std::getline(std::cin, input);
std::istringstream s(input);
s >> command >> param1 >> param2 >> param3 >> param4 >> param5;
//add students
if (command == "add"){
Student *newStudent = new Student(param1, param2, param3, param4, param5);
studentVector.push_back(*newStudent);
//I also tried this as
//studentVector.push_back(Student(param1, param2, param3, param4, param5);
//and got the same result
}
if (command == "quit"){
break;}
}
}
|