出于某种原因,我不断收到一个错误,指出“toupper不能用作函数”。但对于我的不足之处,toupper是一个将小写字母转换为大写字母的全局函数。获取数组与Toupper一起工作
#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;
}
'string arrayinput [20] = input'应该做什么? – Naveen 2012-02-28 04:41:27
接受输入并将其制成数组 – kd7vdb 2012-02-28 04:42:55
@ kd7vdb:这不是它的工作原理。你不能只接受一个'std :: string'并且“把它变成一个数组”。 – 2012-02-28 04:57:48