No conversion from “const char” to “int”

前端 未结 6 1196
野性不改
野性不改 2021-01-25 11:01

The following is the problem code.

#include 
#include 
using namespace std;

void convertToUppercase(char *);

int main()
{
    cha         


        
6条回答
  •  情深已故
    2021-01-25 11:46

    All you need to do is change while (*sPtr != "\0") to while (*sPtr != '\0'). You're trying to compare a char to a string. I agree with @chris, though, you don't need to check if it's lower case. It's just messy to do so, and it won't decrease the running time of your algorithm.

提交回复
热议问题