懂C++的看看,我觉得是对的啊,怎么老是说函数excel自定义函数非法。

我的函数怎么总是说函数名错了,并且说string没有定义呢?_c++吧_百度贴吧
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&签到排名:今日本吧第个签到,本吧因你更精彩,明天继续来努力!
本吧签到人数:0成为超级会员,使用一键签到本月漏签0次!成为超级会员,赠送8张补签卡连续签到:天&&累计签到:天超级会员单次开通12个月以上,赠送连续签到卡3张
关注:254,096贴子:
我的函数怎么总是说函数名错了,并且说string没有定义呢?收藏
各位C++大神,看看我的程序到底哪里出了问题,苦思好久自己没有找到问题所在:#include &iostream&#include &cctype&#include &string& void toUpperString(string & str) ; int main(){
cout && "Enter a string (q to quit): " ;
getline(cin , str) ;
while(!("q" == str))
toUpperString(str) ;
cout && str && endl;
cout && "Next string(q to quit): " ;
getline(cin , str) ;
cout && "Bye." &&
return 0 ;} void toUpperString(string & str){
char * const p =
for(int i = 0 ; p[i] != '\0' ; i++)
toupper(p[i]) ;} 运行情况如下:[root 8.2]# g++ 3.cpp -o 33.cpp:5: error: variable or field‘toUpperString’ declared void3.cpp:5: error: ‘string’ was not declaredin this scope3.cpp:5: error: ‘str’ was not declared inthis scope3.cpp: In function ‘int main()’:3.cpp:15: error: ‘toUpperString’ cannot beused as a function3.cpp: At global scope:3.cpp:24: error: variable or field‘toUpperString’ declared void3.cpp:24: error: redefinition of ‘inttoUpperString’3.cpp:5: error: ‘int toUpperString’previously defined here3.cpp:24: error: ‘string’ was not declaredin this scope3.cpp:24: error: ‘str’ was not declared inthis scope上面总说是toUpperstring函数名有问题,我换成a了还是说我这个函数名有问题。它说string没有定义,可是头文件里面已经包含了啊怎么还会有这个错误呢?请大神指教!拜谢!
c++海同强大的师资阵容,因人制定课程内容,分阶段学习.c++就到正规IT技术培训机构-海同科技,培训IT技术面对面教学,免费重读!
这种情况还是把放到main函数外面吧,虽然这不是好习惯……
代码写的好乱
看不明白 你要干什么
注释都没有
std::string
登录百度帐号推荐应用
为兴趣而生,贴吧更懂你。或&&国之画&&&& &&
版权所有 京ICP备号-2
迷上了代码!C++程序解答,看不懂,求大神解释_百度知道C语言问题解答_百度知道在VS2010中编写C++代码,列表初始化vector时,报错:本地函数定义是非法的,如图。_百度知道}

我要回帖

更多关于 excel自定义函数 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信