Hotel Management using Switch Case in C++


Example Program:

Here is the simple program for hotel management using switch case in C++.

Source Code

#include<iostream>
using namespace std;
int main()
{
  int a,qty,rate,total;
  cout<<"\nMENU CARD \nSelect your drink \n1.COFFEE \n2.TEA \n3.COLD COFFEE \n4.MILK SHAKE \n5.JUICE\n";
  cout<<"\nEnter the number :";
  cin>>a;
  switch(a)
  {
  case 1:
    cout<<"\nYou have selected Coffee.\n Enter the quantity :";
    cin>>qty;
    rate=5;
    total=qty*rate;
    cout<<"\nTotal amount :"<<total;
    break;
  case 2:
    cout<<"\nYou have selected Tea.\n Enter the quantity :";
    cin>>qty;
    rate=10;
    total=qty*rate;
    cout<<"\nTotal amount :"<<total;
    break;
  case 3:
    cout<<"\nYou have selected Cold coffee.\n Enter the quantity :";
    cin>>qty;
    rate=15;
    total=qty*rate;
    cout<<"\nTotal amount :"<<total;
    break;
  case 4:
    cout<<"\nYou have selected Milk shake.\n Enter the quantity :";
    cin>>qty;
    rate=20;
    total=qty*rate;
    cout<<"\nTotal amount :"<<total;
    break;
  case 5:
    cout<<"\nYou have selected Juice.\n Enter the quantity :";
    cin>>qty;
    rate=15;
    total=qty*rate;
    cout<<"\nTotal amount :"<<total;
    break;
  default:
    cout<<"\nSorry Unavailable...s"<<a;
    break;
  }
  return 0;
}
To download raw file Click Here

Output

MENU CARD 
Select your drink 
1.COFFEE 
2.TEA 
3.COLD COFFEE 
4.MILK SHAKE 
5.JUICE

Enter the number :4
You have selected Milk shake.
 Enter the quantity :2
 Total amount :40

Basic Programs


Flow Control

IF Statement Examples


Switch Case


Goto Statement


Break and Continue


While Loop


Do While Loop


For Loop


Friend Function in C++


String Examples


Array Examples


Structure Examples


Structure & Pointer Examples


Structure & Functions Examples


Enumeration Examples


Template Examples


Functions


Inheritance Examples

Hierarchical Inheritance


Hybrid Inheritance


Multilevel Inheritance


Multiple Inheritance


Single Level Inheritance


Class and Objects

Constructor Example


Destructor Example


Operator Overloading Example


List of Programs


Pointer Examples


Memory Management Examples


Pointers and Arrays


Virtual Function Examples



Learn All in Tamil © Designed & Developed By Tutor Joes