T
tvn007
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,line)){
if (line.find("#")!=string::npos)continue ;
istringstream anyname(line);
/////////// HOW CAN I ABBREV. EXPRESSION BELOW ?
////////////////////////////////////////
anyname>>ptrstudent->bypassed>>ptrstudent->name>>ptrstudent->midterm;
anyname>>ptrstudent->quiz>>ptrstudent->final>>ptrstudent->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,line)){
if (line.find("#")!=string::npos)continue ;
istringstream anyname(line);
/////////// HOW CAN I ABBREV. EXPRESSION BELOW ?
////////////////////////////////////////
anyname>>ptrstudent->bypassed>>ptrstudent->name>>ptrstudent->midterm;
anyname>>ptrstudent->quiz>>ptrstudent->final>>ptrstudent->testname;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ptrstudent++;
}
}