Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- // ποιος δεν βαριέται να βάζει συνέχεια std::...
- using namespace std;
- // Κλάση <Person>
- class Person
- {
- public:
- Person(string name, string car , int age)
- {
- this->name = name;
- this->car = car;
- this->age = age;
- }
- // Όνομα του <Person>
- string getName(string name)
- {
- cout << "Provide the Name of the Person" << endl;
- cin >> name;
- return name;
- }
- // Όνομα αυτοκινήτου του <Person>
- string getCar(string car)
- {
- cout << "Provide the Name of the Person's car" << endl;
- cin >> car;
- return car;
- }
- // Ηλικία του <Person>
- int getAge(int age)
- {
- cout << "Provide the Age of the Person" << endl;
- cin >> age;
- return age;
- }
- private:
- string name, car;
- int age;
- };
- int main()
- {
- string name;
- string car;
- int age;
- cout << "Let's write some info!" << endl;
- Person User(name, car , age);
- cout << "Person's name: " << User.getName(name) << endl;
- cout << "Person's Car: " << User.getCar(car) << endl;
- cout << "Person's age: " << User.getAge(age) << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment