423,846 Members | 2,048 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 423,846 IT Pros & Developers. It's quick & easy.

no match for call to '(std::string {aka std::basic_string<char>}) (char&, const char

P: 2
hi,the error shows at if(strmp(str[a],"A")==0)
PLEASE HELP





#include <iostream>
#include <cstring>
#include <fstream>
#include <string>
using namespace std;
void grade( string str,int score);
void grade( string str,int score)
{
int a;
string strmp;
for(a=0;a<60;a++){


if(strmp(str[a],"A")==0)
{
score = 4.00;

}
if(strmp(str[a],"A-")==0)
{
score=3.67;
cout<<score;
}
if(strmp(str[a],"B+")==0)
{
score=3.33;
cout<<score;
}
if(strmp(str[a],"B")==0)
{
score=3.00;
cout<<score;
}
if(strmp(str[a],"B-")==0)
{
score=2.67;
cout<<score;
}
if(strmp(str[a],"C+")==0)
{
score=2.33;
}
if(strmp(str[a],"C")==0)
{
score=2.00;
}
if(strmp(str[a],"C-")==0)
{
score=1.67;
}
if(strmp(str[a],"D+")==0)
{
score=1.33;
}
if(strmp(str[a],"D")==0)
{
score=1.00;
}
if(strmp(str[a],"D-")==0)
{
score=0.67;
}
if(strmp(str[a],"F")==0)
{
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(!inputFile.eof() && a<60)
{


inputFile>>sem[a]>>name[a]>>unit[a]>>str[a];

a++;

}
inputFile.close();
number=a;

for(a=0;a<number;a++)
{


cout<<sem[a]<<"\t"<<name[a]<<"\t"<<unit[a]<<"\t"<<str[a]<<endl;

}
grade(str,score);

return 0;
}
1 Week Ago #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.