NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

#include <iostream>
#include <string>
#include <vector>
using namespace std;
//Class tourist
class tourist
{string name,country;//opening class
int birthday;
char sex;

public:
tourist(){name=country="xxx";birthday=0;sex='m';}//default constructor

tourist (string n,string c,int b,char s)//explicit constructor
{name=n,country=c,birthday=b,sex=s;}

tourist( const tourist& tr): //copy constructor
name( tr.name ),country( tr.country),sex( tr.sex),birthday(tr.birthday)//end of constructor
{}

~tourist()//destructor
{}

//Set functions Name
void setName(string n)
{
name = n;
}

//Set functions Country
void setCountry(string c)
{
country = c;
}

//Set functions Birthday
void setBirthday(int b)
{
birthday = b;
}

//Set functions Sex
void setSex(char s)
{
sex = s;
}

//Get functions Name
string getName()
{
return name;
}

//Get functions Country
string getCountry()
{
return country;
}

//Get functions Birthday
int getBirthday()
{
return birthday;
}

//Get functions Sex
char getSex()
{
return sex;
}

//Function Age
int age(){
return 2015-birthday;
}

bool operator<(tourist t){
return (this->age()<t.age()) ? true: false;
}// like if else

//Print function
void print(){
cout<<"Name:"<<" "<<name<<endl;
cout<<"Country:"<<" "<<country<<endl;
cout<<"Birthday:"<<" "<<birthday<<endl;
cout<<"Sex:"<<" "<<sex<<endl;
}
};//closing class


//Class hotel
class hotel:public tourist //inherit Tourist class
{string nameH;
int days, cost;
public:
hotel ():tourist() {nameH="xxx";days=cost=0;}; //default constructor

hotel (string h,int d,int co){nameH=h,days=d,cost=co;}//explicit constuctor

hotel (string h ,int d ,int co ,string n,string c,int b,char s):tourist ( n, c, b, s){
nameH=h,days=d,cost=co;
};//copy constuctor

int bill(){return days*cost;}

bool operator<(hotel b){
return (this->bill()<b.bill()) ? true: false;
}// like if else

void print(){
tourist::print();
cout<<"Name of the hotel:"<<" "<<nameH<<endl;
cout<<"Days of rest:"<<" "<<days<<endl;
cout<<"Cost per day:"<<" "<<cost<<endl;
cout<<" "<<endl;
}

};//closing class

int main()
{
tourist tm1,tm2,tm3;
hotel people[3];
vector<hotel> v;

hotel h1("Hilton",5,100,"Rashad","Azerbaijan",1993,'m');
hotel h2("Atlant",2,800,"Nijat","Azerbaijan",1994,'m');
hotel h3("Black Sea",3,500,"Adam","Poland",1989,'m');
v.push_back(h1);
h1.print();
h2.print();
h3.print();
hotel people[3]={h1,h2,h3};

system("pause");

}
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.