#include <iostream>
#include <cstring>
#include <fstream>
using namespace std;
int average(){
if(str[a]=="A")
{
score = 4.00;
}
if(str[a]=="A-")
{
score=3.67;
}
if(str[a]=="B+")
{
score=3.33;
}
if(str[a]=="B")
{
score=3.00;
}
if(str[a]=="B-")
{
score=2.67;
}
if(str[a]=="C+")
{
score=2.33;
}
if(str[a]=="C")
{
score=2.00;
}
if(str[a]=="C-")
{
score=1.67;
}
if(str[a]=="D+")
{
score=1.33;
}
if(str[a]=="D")
{
score=1.00;
}
if(str[a]=="D-")
{
score=0.67;
}
if(str[a]=="F")
{
score=0.00;
}
}
int main()
{
int sem[60];
string name[60]="";
int unit[60];
string str[60];
int a=0;
int number;
string matric;
float score;
ifstream inputFile;
ofstream tnputFile;
inputFile.open( "result.txt ");
if(!inputFile)
{
cout<<"Error opening file"<<endl;
system("pause") ;
return 1;
}
while(!inputFil e.eof() && a<60)
{
inputFile>>sem[a]>>name[a]>>unit[a]>>str[a];
a++;
}
inputFile.close ();
number=a;
for(a=0;a<numbe r;a++)
{
cout<<sem[a]<<"\t"<<name[a]<<"\t"<<unit[a]<<"\t"<<str[a]<<endl;
}
return 0;
}
#include <cstring>
#include <fstream>
using namespace std;
int average(){
if(str[a]=="A")
{
score = 4.00;
}
if(str[a]=="A-")
{
score=3.67;
}
if(str[a]=="B+")
{
score=3.33;
}
if(str[a]=="B")
{
score=3.00;
}
if(str[a]=="B-")
{
score=2.67;
}
if(str[a]=="C+")
{
score=2.33;
}
if(str[a]=="C")
{
score=2.00;
}
if(str[a]=="C-")
{
score=1.67;
}
if(str[a]=="D+")
{
score=1.33;
}
if(str[a]=="D")
{
score=1.00;
}
if(str[a]=="D-")
{
score=0.67;
}
if(str[a]=="F")
{
score=0.00;
}
}
int main()
{
int sem[60];
string name[60]="";
int unit[60];
string str[60];
int a=0;
int number;
string matric;
float score;
ifstream inputFile;
ofstream tnputFile;
inputFile.open( "result.txt ");
if(!inputFile)
{
cout<<"Error opening file"<<endl;
system("pause") ;
return 1;
}
while(!inputFil e.eof() && a<60)
{
inputFile>>sem[a]>>name[a]>>unit[a]>>str[a];
a++;
}
inputFile.close ();
number=a;
for(a=0;a<numbe r;a++)
{
cout<<sem[a]<<"\t"<<name[a]<<"\t"<<unit[a]<<"\t"<<str[a]<<endl;
}
return 0;
}