The following is the problem code.
#include <iostream>
#include <cctype>
using namespace std;
void convertToUppercase(char *);
int main()
{
char phrase[] = "characters and $32.98";
cout << "The phrase before conversion is : " << phrase;
convertToUppercase(phrase);
cout << "\nThe phrase after conversion is : " << phrase << endl;
return 0;
}
void convertToUppercase(char *sPtr)
{
while (*sPtr != "\0")
{
if (islower(*sPtr))
*sPtr = toupper(*sPtr);
cout << "sPtr (before) = " << sPtr;
sPtr++;
cout << "\nsPtr (after) = " << sPtr << endl;
}
}
The output window shows me that :
1>d:\sync files\converting lowercase letter to uppercase letters\converting lowercase letter to uppercase letters\main.cpp(19): error C2446: '!=' : no conversion from 'const char *' to 'int'
1> There is no context in which this conversion is possible
1>d:\sync files\converting lowercase letter to uppercase letters\converting lowercase letter to uppercase letters\main.cpp(19): error C2040: '!=' : 'int' differs in levels of indirection from 'const char [2]'
Where is the mistake I made? I have exactly copied the code from my book but the problem still exists.
Sorry, I cannot find it out. need Help.
Thank you for your attention.