首页 > 用户发贴区 > 编程问题提问区 > 帮忙看看这段代码为什么总是报错
2009
04-26

帮忙看看这段代码为什么总是报错

用vc6.0总是报错。


#include<iostream>


using std::cout;
using std::cin;
using std::endl;


int main()
{
  int total,              //sum of grades
  gradecounter,           //number of grades entered
  grade,                  //one grade
  average;                //average of grades
 
   //initialization phase
   total=0;               //clear total
   gradecounter=1         //prepare to loop
   
   //propessing phase
   while(gradecounter<=10);          //loop 10times
      cout<<”enter grade:”;          //prompt for input
      cin>>grade;                    //input grade
      gradecounter=gradecounter+1;   //increment counter


//termination
average=total/10;         //integer division
cout<<”class average is”<<average<<endl;


return 0;
}


帮忙看看这段代码为什么总是报错》有 1 条评论

  1. diantouxiao 说:

    //initialization phase
       total=0;               //clear total
       gradecounter=1         //prepare to loop
       
    第3行掉了个分号

留下一个回复