#include<iostream.h>
#include<conio.h>
class bill{ public:
char name;
int units;
float tbill;
float tbill1,tbill2,tbill3;
void input(){
cout<<"Enter the name:\t";
cin>>name;
cout<<"Enter the units:\t";
cin>>units;
}
void output()
{
switch(units)
{
case 100:
{tbill1=units*0.6;
cout<<"Total bill=\t"<<tbill1;
}
case 200:
{tbill2=units*0.8;
cout<<"Total bill:\t"<<tbill2;
}
case 300:
{tbill3=units*0.9;
cout<<"Total bill:\t"<<tbill3;
}
float tbill()
{
return tbill1+tbill2+tbill3;
}
}}
};
void main(void)
{
bill n;
n.input();
n.output();
tbill=n.tbill;
cout<<"Over all bill:\t"<<tbill;
getch();
}
#include<conio.h>
class bill{ public:
char name;
int units;
float tbill;
float tbill1,tbill2,tbill3;
void input(){
cout<<"Enter the name:\t";
cin>>name;
cout<<"Enter the units:\t";
cin>>units;
}
void output()
{
switch(units)
{
case 100:
{tbill1=units*0.6;
cout<<"Total bill=\t"<<tbill1;
}
case 200:
{tbill2=units*0.8;
cout<<"Total bill:\t"<<tbill2;
}
case 300:
{tbill3=units*0.9;
cout<<"Total bill:\t"<<tbill3;
}
float tbill()
{
return tbill1+tbill2+tbill3;
}
}}
};
void main(void)
{
bill n;
n.input();
n.output();
tbill=n.tbill;
cout<<"Over all bill:\t"<<tbill;
getch();
}
No comments:
Post a Comment