How to fix this error?????

0 votes
asked Oct 2, 2018 by NaveedAsif (150 points)
#include<iostream>
using namespace std;
void ToUpper(char *j)
 int main(){
    char j;
    cout<<"please enter the character:"<<j<<;
    cin>>j;
    ToUpper(j)
    cout<<"String to upper case is given below:"<<"\t"<<j;
}
//fucntion we unsigned
void ToUpper(char *m)
{
    if(islower(*m));
    *m=toupper(*m);
    
}

Compilation failed due to following error.
" initializer required before int main"

1 Answer

0 votes
answered Oct 3, 2018 by Zach Phar (140 points)
I got it to compile but i am pointing in the wrong direction.

#include<iostream>
using namespace std;
void ToUpper(char *j);
 int main(){
    char j;
    char *ptr;
    cout<<"please enter the character:"<<j<<endl;
    cin>>j;
    *ptr = j;
    ToUpper(ptr);
    
    cout<<"String to upper case is given below:"<<"\t"<<j;
}
//fucntion we unsigned
void ToUpper(char *m)
{
    if(islower(*m))
    *m=toupper(*m);
    
}
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...