#include<iostream>
using namespace std;
class HighSchoolGrade
{
public:
int input()
{
int score=0;
cout<<" Input total score : ";
cin>>score;
if(score>100)
cout<<"Error :"<<endl;
else if(score>=80)
cout<<"Grade 4 :"<<endl;
else if(score>=75)
cout<<"Grade 3.5 :"<<endl;
else if(score>=70)
cout<<"Grade 3 :"<<endl;
else if(score>=65)
cout<<"Grade 2.5 :"<<endl;
else if(score>=60)
cout<<"Grade 2 :"<<endl;
else if(score>=55)
cout<<"Grade 1.5 :"<<endl;
else if(score>=50)
cout<<"Grade 1 :"<<endl;
else if (score>=0)
cout<<"Grade 0 :"<<endl;
cout<<" ....End of program....";
}
void Displaynumber(int score)
{
int loop=1;
while(loop<=score)
{
cout<<"Loop"+loop;
loop++;
}
}
};
class playLoop
{
public:
void main()
{
HighSchoolGrade p;
p=new HighSchoolGrade ();
int Score=0;
p.Displaynumber(Score);
}
};
C++ อยากทราบว่าผมผิดตรงไหนหรอครับ ตรงบันทัดp=new ขึ้นeror
using namespace std;
class HighSchoolGrade
{
public:
int input()
{
int score=0;
cout<<" Input total score : ";
cin>>score;
if(score>100)
cout<<"Error :"<<endl;
else if(score>=80)
cout<<"Grade 4 :"<<endl;
else if(score>=75)
cout<<"Grade 3.5 :"<<endl;
else if(score>=70)
cout<<"Grade 3 :"<<endl;
else if(score>=65)
cout<<"Grade 2.5 :"<<endl;
else if(score>=60)
cout<<"Grade 2 :"<<endl;
else if(score>=55)
cout<<"Grade 1.5 :"<<endl;
else if(score>=50)
cout<<"Grade 1 :"<<endl;
else if (score>=0)
cout<<"Grade 0 :"<<endl;
cout<<" ....End of program....";
}
void Displaynumber(int score)
{
int loop=1;
while(loop<=score)
{
cout<<"Loop"+loop;
loop++;
}
}
};
class playLoop
{
public:
void main()
{
HighSchoolGrade p;
p=new HighSchoolGrade ();
int Score=0;
p.Displaynumber(Score);
}
};