Thursday, September 23, 2010

Program arithmetic operations using class in c++

#include
Class abc
{
Private:
Int a, b;
Char ch;
Public:
Void fun()
{
do

{
Cout<<”enter 1 for add”<<”enter 2 for delete”<<”enter 3 for multiply” <<”enter 4 for divide”<<”enter 5 for mode”; Cin>>ch;
Switch(ch)
{
Case 1:
Cout<<””enter two no for addition; Cin>>a>>b;
Cout<<”sum=”<<<”enter two no”; Cin>>a>>b;
Cout<<”diff=”<<<”enter two no ”; Cin>>a>>b;
Cout<<”mul=”<<<”enter two no”; Cin>>a>>b;
Cout<<”result of divide=”<<<”enter two no” Cin>>a>>b;
Cout<<”mod=”<
Break;
Default:
Cout<<”enter right no”
Break;
}
While(ch!=0)
}
};
Int main()
{

Abc m;
m.fun();
return(0);
}

PROGRAMME PRINT HELLO


#include<iostream.h>
                Class abc
                {
Int c;
Char  s;
Public:
                Void aaa()
{
                Cout<<”do you want to print”
                Cout<<”enter y for YES and n for NO”;
                Cin>>c;
Switch(c)
{
Cout<”enter which you want to print”>
Cin>>s;
Cout<<s;
}
}
};
Int main()
{
Abc n;
n.aaa();
return(0);
}