invalid operands of types 'int' and 'const char [27]' to binary...
发布网友
发布时间:2024-10-20 09:01
我来回答
共1个回答
热心网友
时间:2024-10-31 12:17
问题在这句:
int i,cout=0,total=0; //cout是c++预定义的对象,你把它定义成int了,看代码逻辑我估计这个cout应该是count
改了:
#include<iostream>
using namespace std;
int main() {
bool letter[53];
int i, count = 0, total = 0; //count
for (i = 1; i < 53; i++) letter[i] = 1;
while (total < 26) {
for (i = 1; i < 53; i++) {
if (letter[i]) {
count++; //count
if (count == 9) { //count
count = 0; //count
letter[i] = 0;
total++;
}
}
if (total == 26) break;
}
}
cout << "圆环中的小写字母的位置为:" << endl;
for (i = 1; i < 53; i++) {
if (!letter[i]) cout << i << " ";
}
return 0;
}