#include <fstream>
#include <sstream>
#include <vector>
#include <iterator>
#include "esame.h"
using namespace std;
int main(int argc, char** argv) {
fstream myFile;
string stringa,nome;
stringstream ss;
esame *ex= new esame;
int count=0,crediti,voto;
vector <esame> esami;
vector <esame>:: iterator it;
myFile.open("testFile");
myFile.seekp (myFile.beg);
while(getline(myFile,stringa,'\t')){
stringstream ss(stringa);
if(count==0){
ss>>crediti;
} else if(count==1){
ss>>voto;
} else{
ex->setVoto(voto);
ex->setCrediti(crediti);
ex->setNome(stringa);
esami.push_back(*ex);
count=-1;
}
ss.clear();
count++;
}
for( it= esami.begin(); it!=esami.end() ; it++ )
cout<<it->getCrediti()<<" "<<it->getNome()<<" "<<it->getVoto()<<endl;
return 0;
la cout semplicemente stampa su schermo.