I am working on the data struc. below:
is there way I can abbrev. the expression below to avoid long
expression.
Thanks......
///////////////////////////////////////////////////////////////////////////////////
#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 ;
istringstream anyname(line);
/////////// HOW CAN I ABBREV. EXPRESSION BELOW ?
////////////////////////////////////////
anyname>>ptrstu dent->bypassed>>ptrs tudent->name>>ptrstude nt->midterm;
anyname>>ptrstu dent->quiz>>ptrstude nt->final>>ptrstud ent->testname;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ptrstudent++;
}
}
is there way I can abbrev. the expression below to avoid long
expression.
Thanks......
///////////////////////////////////////////////////////////////////////////////////
#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 ;
istringstream anyname(line);
/////////// HOW CAN I ABBREV. EXPRESSION BELOW ?
////////////////////////////////////////
anyname>>ptrstu dent->bypassed>>ptrs tudent->name>>ptrstude nt->midterm;
anyname>>ptrstu dent->quiz>>ptrstude nt->final>>ptrstud ent->testname;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ptrstudent++;
}
}
Comment