For some reason I keep getting a error that says “toupper cannot be used as a function”. But to my undersatnding toupper is a global function that converts lowercase chars to uppercase.
#include <cctype>
#include <iostream>
#include <string>
using namespace std;
int main ()
{
string input;
string output;
int toupper;
cout<<"Enter a String of Charchters to be Capitalized : ";
cin>>input;
string arrayinput[20]= input;
output = toupper(arrayinput);
cout<<"\n\n\n"<<output<<"\n\n\n";
cout<<"Press <Enter> to Exit";
cin.ignore();
cin.get();
return 0;
}
You’ve created a local variable called
int toupper– rename that one to something else.Edit to add:
There are more problems than just this.
inputis a string; you want to iterate through the length of that string and getchar*at each position usingstring::at(i). Then useatoito convert the char to an int, which is the type thattouppertakes as an argument.