我有以下代码:
#include <iostream>
int main() {
int i = 3;
do {
(i == 3) ? (std::cout << "Is 3.\n") : ++i;
++i;
} while ( i < 4 );
return 0;
}
并得到以下错误响应:
ternary.cc: In function ‘int main()’:
ternary.cc:5:43: error: invalid conversion from ‘void*’ to ‘int’ [-fpermissive]
我的代码有什么问题?