how can I use object in switch case

April 1, 2011 at 04:03:07
Specs: Windows XP
Ex:
class invoice
{
private:
int rate,qty,amt;
public:
void in();
{
cout<<"Enter rate and qty: ";
cin>>rate>>qty;
}
void out();
{
amt=rate*qty;
cout<<endl<<rate<<qty<<amt;
}
};
void main()
{
class invoice b;
int ch;
clrscr();
cout<<"Enter any Choice: ";
cin>>ch;
switch(ch)
{
case 1: b.in();
break;
case 2:b.out();
break;
}
getch();
}
When run this program then enter your choice, if I enter 1 then input rate and qty, if I enter 2 then display rate,qty, and amt which i input.

See More: how can I use object in switch case

Report •


#1
April 1, 2011 at 04:49:12
1. This is in the wrong forum. It's a Programming matter, not a Security one.

2. I don't see a question here. What is your problem?


Report •
Related Solutions


Ask Question