Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class student {
- private:
- string name, surname;
- int age;
- public:
- student(string _name = "", string _surname = "", int _age = 0) {
- name = _name;
- surname = _surname;
- age = _age;
- }
- friend void check_age(student S);
- };
- void check_age(student s) {
- if(s.age > 25) {
- cout << "YES " << s.name << " " << s.surname << endl;
- }
- else {
- cout << "NO" << endl;
- }
- }
- int main() {
- student s("a", "b", 30);
- check_age(s);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement