NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

#include<iostream>
#include<conio.h>
#include<fstream>
#include<stdio.h>
#include<stdlib.h>
#include<dos.h>

using namespace std;
class hotel
{

int nr_dhomes;
char emri[30];
char adresa[50];
char celular[10];

public:

void menuja_kryesore();
void shto();
void shfaq();
void dhomat();
void ndrysho();
int kontrollo(int);
void modifiko(int);
void fshij_rezultate(int);
void fatura(int);
};








void hotel::menuja_kryesore()
{

int zgjedhja;
while(zgjedhja!=5)
{

system("cls");
cout<<"ntttt*************************";
cout<<"ntttt Menaxhim hoteli";
cout<<"ntttt * Menuja kryesore *";
cout<<"ntttt*************************";
cout<<"nnnttt1.Rezervo nje dhome";
cout<<"nttt2.Te dhenat e klientet";
cout<<"nttt3.Dhomat e zena";
cout<<"nttt4.Ndrysho te dhenat";
cout<<"nttt5.Dil";
cout<<"nntttZgjidh: ";
cin>>zgjedhja;

switch(zgjedhja)
{

case 1: shto();
break;

case 2: shfaq();
break;

case 3: dhomat();
break;

case 4: ndrysho();
break;

case 5: break;

default:
{

cout<<"nnttt zgjedhja gabuar.....!!!";
cout<<"ntttShtyp nje buton....!!";
getch();

}

}

}

}






void hotel::shto()
{

system("cls");
int r,flag;
ofstream fout("Hotel.txt",ios::app);

cout<<"n Hidh te dhenat e klientit";
cout<<"n ----------------------";
cout<<"nn Nr dhomes: ";
cout<<"n Nr i dhomes 0- 50";
cout<<"n Dhoma normale 1 - 30";
cout<<"n Dhoma lux 31 - 45";
cout<<"n Dhoma royal 46 - 50";
cout <<"n Vendos nr e dhomes ne te cilen do te qendroni :- "<<endl;
cin>>r;

flag=kontrollo(r);

if(flag)
cout<<"n Na vjen keq! Dhoma eshte e zene!";

else
{

nr_dhomes=r;
cout<<" Emri: ";
cin>>emri;
cout<<" Adresa: ";
cin>>adresa;
cout<<" Nr Celularit: ";
cin>>celular;

fout.write((char*)this,sizeof(hotel));
cout<<"n Dhoma eshte rezervuar...!!!";

}

cout<<"n Shtyp nje button.....!!";

getch();
fout.close();

}

void hotel::shfaq()
{

system("cls");

if stream fin("Hotel.txt",ios::in);
int r, flag;

cout<<"n Vendos nr e dhomes per te pare te dhenat e klientit:-"<<endl;
cin>>r;

while(!fin.eof())
{

fin.read((char*)this,sizeof(hotel));
if(nr_dhomes==r)
{
system("cls");
cout<<"n Te dhenat e klientit";
cout<<"n_ _ _ _ _ _ _ _ _ _ _";
cout<<"nn Nr i dhomes:"<<nr_dhomes;
cout<<"n Emri:"<<emri;
cout<<"n Adresa: "<<adresa;
cout<<"n Nr i cel: "<<celular;
flag=1;
break;
}
}
if(flag==0)
cout<<"n Na vjen keq nuk u gjend nr i dhomes...!!";
cout<<"nn Shtypni nje buton per te vazhduar...!!";

getch();
fin.close();
}

void hotel::dhomat(){
system("cls");

ifstream fin ("Htel.txt",ios::in);
cout<<"Lista e dhomave te zena"<<endl;
cout<<endl;

cout<<"n Nr i dhomest t Emri i klientit t t Adresa t t Nr celularit"endl;
while(!fin.eof())
{
fin.read((char*)this,sizeof(hotel));
cout<<nr_dhomes<<"t t"<<emri<<"tt" <<adresa<<"tt"<<celular<<endl;
}
cout<<"nntt" <<Shtyp nje buton per te dal<<endl;
getch();
fin.close();
}
void hotel::ndrysho(){
system("cls";)
int zgjedhje, r;
cout<<"MENU"<<endl
cout<<" 1. Ndrysho te dhenat e klientit"<<endl;
cout<<"n 2. Fshi klientin"<<endl;
cout<<"n 3. Fatura e klienit"<<endl;

cout<<"n Beni zgjedhjen tuaj:"<<endl;
cin>>zgjedhje;

cout<<"n Zgjidh nr e dhomes"<<endl;
swithch(zgjedhja){

case 1 : modifiko(r);
break;

case 2 : fshi_rezultatet(r);
break;

case 3: fatura(r);
brak;

default:
cout<<"Zgjedhje e gabuar:" ;
}
cout<<"n Shtyp nje buton per te vazhduar"<<endl;
getch();
}

int hotel::kontrollo(int r){
int flag=0;
ifstream fin("Hotel.txt",ios::in);
while(!fin.eof())
{

fin.read((char*)this,sizeof(hotel)) ;
if(nr_dhomes==r){
flag=1;
break;
}
}
fin.close();
return (flag);
}

void hotel::modifiko(int r){

int pos ,flag=0;
fstream file("Hotel.txt", ios::in|ios::out);
While(!fin.eof())
{
pos=file.tellg();
file.read((char*)this sizeof(hotel) );

if (nr_dhomes==){
cout<<"Vensdos te dhenat e reja per klientin:"<<endl;
cout<<endl;

cout<<"Emri:";
cin>>emri;
cout<<"Adresa:";
cin>>adresa;
cout<<"Nr celularit:";
cin>>celular;
file.seekg(pos);
file.write((char*)this,sizeof(hotel));
cout<<"Te dhenat u modifikuan me sukses"<<endl;
flag=1;
break;

void hotel::fshij_rezultate(int r)
{
int flag=0;
char ch;
ifstream fin("Hotel.txt",ios::in);
ofstream fout("temp.dat",ios::out);

while(!fin.eof())
{
fin.read((char*)this,sizeof(hotel));
if(nr_dhomes==r)

{

cout<<"n Emri:"<<emri;
cout<<"n Adresa:"<<adresa;
cout<<"n Nr.Cel:"<<celular;
cout<<"nn Deshiron te fshish kete te dhene(y/n);" ;
cin>>ch;

if (ch=='n')
fout.write((char*)this,sizeof(hotel));

}

fin.close();
fout.close();

if(flag==0)
cout<<"n Gabim, nr i dhomes nuk u gjend !";

else
{
remove("Hotel.txt");
rename("temp.dat","Hotel.txt");
}



}
void hotel::fatura(int r)
{
hotel h1;
ifstream f1;
f1.open("Hotel.txt",ios::in|ios::binary);

if(!f1)
cout<<"Nuk mund te hapet";

else
{
f1.read((char*)&h1,sizeof(hotel));
while(f1)

{
f1.read((char*)&h1,sizeof(hotel));
while(f1)
{
f1.read((char*)&h1,sizeof(hotel));
}

if(h1.nr_dhomes==r)
{
if(h1.nr_dhomes>=1&&h1.nr_dhomes<=30)
cout<<"Fatura juaj= 2000";

else if(h1.nr_dhomes>=35&&h1.nr_dhomes<=45)
cout<<"Fatura juaj=5000";

else{

cout<<"Nr i dhomes nuk u gjend"}
}
f1.close();
getch();

}

int main(){
int h;
cout<<"Miresevini ne Four Season Hotel !"<<endl;
cout<<"Rezervo llojin e dhomes qe deshironi"<<endl;
cout<<"Zgjidhni numrin e diteve te qendrimit ne dhomen qe zgjodhet"<<endl;
cout<<"Vendosni te dhenat e klientit"<<endl;
cout<<"Qendrim te kendshem!"<<endl;

void menuja_kryesore();

return o ;


}



Write a note in this area. It's really easy to share with others. Click here ...
     
 
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.