Please help why this code not compile
I would like it to be something like this:
istringstream stringstreams(l ine);
stringstreams>> ptrstudent->bypassed>>ptrs tudent->name>>ptrstude nt->midterm;
stringstreams>> ptrstudent->quiz>>ptrstude nt->final>>ptrstud ent->testname;
///////////////////////////////////////////////////////////////////////////////////////////////////////
#include <iostream>
#include <string>
#include <fstream>
#include <sstream>
using namespace std;
const int MAX=50;
struct Record_info {
string bypassed;
string name;
int midterm;
double quiz;
double final;
string testname;
}student[MAX],*ptrstudent;
int main (void){
ptrstudent = student;
ifstream in ("test2.txt" );
string line;
string line2;
char buffer[40];
while (getline(in,lin e)){
if (line.find("#") !=string::npos) continue ;
istream& operator >>(istream & is,prtstudent & r){
is>>r.bypassed> >r.name>>r.midt erm,r.quiz,r.fi nal,r.testname; }
ptrstudent++;
}
return 0;
}
I would like it to be something like this:
istringstream stringstreams(l ine);
stringstreams>> ptrstudent->bypassed>>ptrs tudent->name>>ptrstude nt->midterm;
stringstreams>> ptrstudent->quiz>>ptrstude nt->final>>ptrstud ent->testname;
///////////////////////////////////////////////////////////////////////////////////////////////////////
#include <iostream>
#include <string>
#include <fstream>
#include <sstream>
using namespace std;
const int MAX=50;
struct Record_info {
string bypassed;
string name;
int midterm;
double quiz;
double final;
string testname;
}student[MAX],*ptrstudent;
int main (void){
ptrstudent = student;
ifstream in ("test2.txt" );
string line;
string line2;
char buffer[40];
while (getline(in,lin e)){
if (line.find("#") !=string::npos) continue ;
istream& operator >>(istream & is,prtstudent & r){
is>>r.bypassed> >r.name>>r.midt erm,r.quiz,r.fi nal,r.testname; }
ptrstudent++;
}
return 0;
}
Comment