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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Haza
    New Member
    • Dec 2018
    • 2

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

    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(!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;

    }
    grade(str,score );

    return 0;
    }
Working...