令牌错误之前的预期主表达式'<'

expected primary-expression before '<' token error

本文关键字:表达式 lt 错误 令牌      更新时间:2023-10-16

嗨,我将回到C编程练习中,在这个特定的程序中,我在'<'之前得到了一个预期的主表达式第8行的令牌(While循环)。非常感谢对我需要修复的内容及其背后的原因进行澄清。这是代码,非常感谢!

#include <stdio.h>
#include <iostream>
using namespace std;
int main(){
   int number, i=8;
   cout <<"Please enter all numbers from 8-23n";
   cout <<"Start Now: ";
   while (i=<23){
          cin>>number;
          cout<<"Next: ";
          if (number!=i){
             cout<<"That was the wrong, Please enter: "<<i<<endl;
          }
         else 
           i++;
    }
    cout<<"Congratulations!!n";
return 0;
}
while (i=<23){
        ^^

请改用while (i <= 23)

while (i=<23){应为while(i<=23){