My issue
using namespace std;
class Student {
public: string name;
int score;
int age;
void eligible() {
if (score > 10 && age > 20) {
cout << "YES";
}
else {
cout << "NO";
}
}
}
int main() {
Student obj;
obj.name = “Tom”;
obj.score = 15;
obj.age = 21;
obj.eligible();
return 0;
}
My code
#include <iostream>
using namespace std;
class Student {
public:
string name;
int score;
int age;
void eligible() {
if (score > 10 && age > 20) {
cout << "YES";
}
else {
cout << "NO";
}
}
}
int main() {
Student obj;
obj.name = "Tom";
obj.score = 15;
obj.age = 21;
obj.eligible();
return 0;
}
Learning course: Learn Programming and Problem Solving using C++
Problem Link: https://www.codechef.com/learn/course/sit-cpp-fall/SITFALL53/problems/CPPFALL359