Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4
When you post these questions, please post as much detail as possible so that others don't have to waste time trying to figure out what's wrong. In this case I'm just gonna assume the error message that you get is the problem, the error tells you exactly what the problem is and what to do. error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'int' in return You're trying to return an std::string while the return type is an int which cannot be converted to each other. So you have 2 options, either change the function's return type to an std::string or change grade2's type to an int. The latter one will only get you more errors, so I would suggest you do the former one. Secondly, your function is private, so you cannot access it outside the class, you might consider adding a 'public:' before it. grade2 += 6; You can't just an integer to an std::string, this does something you don't expect it to do. ( It adds the ASCII character that equals 6 to it, not the digit 6, some unprintable character ) You might want to rethink what you're doing there. In the else clause of the if you suddenly change variable: `grade1 = "F";`
6th Apr 2020, 9:33 PM
Dennis
Dennis - avatar