Page 106 - Modular_V1.1_Flipbook
P. 106
else if(age >= 45 && age <= 55) {
HRA = bsalary * 7/100;
DA = bsalary * 12/100;
GrossSalary = bsalary + DA + HRA;
}
else
{
cout<<”Invalid details.\n”;
}
Project 4 Critical Thinking
Write the following C++ code and see the output:
#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
void main()
{
int number=0;
float cost=0;
char ch;
int choice=0;
clrscr();
do
{
cout<<”===== Welcome to ABC Drink Shop! =====”<< endl;
cout<<”We offers following drinks: “<< endl;
cout<<”1: Coffee Rs. 50/-” << endl;
cout<<”2: Apple Juice Rs. 90/-” << endl;
cout<<”3: Soda Rs. 60/-” << endl;
cout<<”4: Tea Rs. 30/-” << endl;
cout<<”5: For Exit\n”;
cout<<”What drink would you like?”<< endl;
label:
cout<<”Enter your choice: “;
cin>>choice;
switch(choice)
{
case 1:
cout<<”Enter number of drinks: “;
cin>>number;
cost = cost + 50 * number;
cout<<”Thank you, You have ordered coffee as your drink.”<<endl;
break;
104 Touchpad MODULAR (Version 1.1)-X

