标签:comparison continue between 字符串
在g++下编译出现ISO C++ forbids comparison between pointer and integer错误
经过检查发现错误如下:
while (cin.get() !="\n")
continue;
将其修改为:
while (cin.get() !=‘\n‘)
continue;
在ISO C++中,"\n"常量字符串比较时是使用字符串的地址,所以为char *;
‘\n’字符,是转换为int常量的,可以与cin.get()比较
所以出现以上错误
ISO C++ forbids comparison between pointer and integer
标签:comparison continue between 字符串
原文地址:http://5228690.blog.51cto.com/5218690/1568746