Sunday, December 02, 2012

REVERSE NUMBER PROGRAM in C++


#include<iostream.h>
 #include<conio.h>

int main()
 {
 int num;

 int rev=0;
 int mod;
 cout<<"Enter Number= ";
 cin>>num;
 do
 {
 mod=num%10;
 rev=(rev*10)+mod;
 num=num/10;
 }
 while(num>=1);
 cout<<"Reverse Is= "<<rev;
 getch();
 }

A-Z in C++


#include<iostream.h>
 #include<conio.h>
 int main()
 {
 char ch='A';
 for(ch='A';ch<='Z';ch++)

 cout<<ch<<",";
 getch();
 }

Time advance program in C++


#include<iostream.h>
#include<conio.h>
class timex {
public:
int hours;
int min;
int seconds;
timex(int h,int m,int s)
{
hours=h;
min=m;
seconds=s;
}
void access(){
 cout<<"hours : "<<hours;
 cout<<"  minutes : "<<min;
 cout<<"  seconds : "<<seconds;
}
void advance(int w,int r,int m){   int a,b,c,e;
cout<<endl<<"enter your hour advance:"; cin>>a;
cout<<endl<<"enter your minutes advance:";  cin>>b;
cout<<endl<<"enter your seconds advance:"; cin>>c;
hours=hours+a;   min=min+b;  seconds=seconds+c;
if(hours>12)
{
            hours=hours%12;

}
if(min>=60)
{   e=min/60;  min=min%60;  hours=hours+e;

}
if(seconds>=60)
{  e=seconds/60;
               min=min+e;
seconds=seconds%60;} }
};
int main()
{        
timex s(12,34,23);                        
 int z,x,v;
s.access();
s.advance(z,x,v);
s.access();
getch();
}

Bill calculation in C++


#include<iostream>


using namespace std;
class customer {
int a;
public:
int e,u,b,d,n;


void domestic(){
if(u<=100){
b=5*u; } if(u>100&&u<=300) {
b=8*u+100;}
if(u>100&&u<=300) {
b=10*u+230;}
} void date(){
if(d>=10){
b=b+200; } }
void showbill(){
cout<<"\nCustomer number: "<<n;
cout<<"\n Numbers of unit consumed: "<<u;
cout<<"\n Today date: "<<d;
cout<<"\nYour bill is Rs: "<<b;
}void commercial(){
b=u*15;
} void info() {
cout<<"\nEnter your customer number: ";  cin>>n;
cout<<"\nEnter your numbers of unit consumed: ";  cin>>u;
cout<<"\nEnter  today date: ";  cin>>d;  }
};
int main(){int e;
cout<<"Enter 1 for domestic user,2 for commercial user: ";
cin>>e;
customer s;
switch(e)
{ case 1:
cout<<" you are domestic user";
break;
case 2:
cout<<"you are commercial user";
break;
default:
cout<<"you entered a invaild choice";

return 0; }
s.info();
if(e==1){
s.domestic();
}
if(e==2){
s.commercial();
}
s.date();
s.showbill();

}

Program shows your star in C++


#include<iostream.h>
#include<conio.h>
int main()
{
    int month;

    cout<<"\nEnter Date: ";
    cin>>date;
    cout<<"\nEnter Month: ";
    cin>>month;
    cout<<"\n\n";

    if(month<=1 && date>=20)
        cout<<"Aquarius";
    else if(month<=2 && date<=18)
        cout<<"Aquarius";
    else if(month<=2 && date>=19)
        cout<<"Pices";
    else if(month<=3 && date<=20)
        cout<<"Pices";
    else if(month<=3 && date>=21)
        cout<<"Aries";
    else if(month<=4 && date<=19)
        cout<<"Aries";
    else if(month<=4 && date>=20)
        cout<<"Taurus";
    else if(month<=5 && date<=20)
        cout<<"Taurus";
    else if(month<=5 && date>=21)
        cout<<"Gemini";
    else if(month<=6 && date<=20)
        cout<<"Gemini";
    else if(month<=6 && date>=21)
        cout<<"Cancer";
    else if(month<=7 && date<=22)
        cout<<"Cancer";
    else if(month<=7 && date>=23)
        cout<<"Leo";
    else if(month<=8 && date<=22)
        cout<<"Leo";
    else if(month<=8 && date>=23)
        cout<<"Virgo";
    else if(month<=9 && date<=22)
        cout<<"Virgo";
    else if(month<=9 && date>=23)
        cout<<"Libra";
    else if(month<=10 && date<=22)
        cout<<"Libra";
    else if(month<=10 && date>=23)
        cout<<"Scorpio";
    else if(month<=11 && date<=21)
        cout<<"Scorpio";
    else if(month<=11 && date>=22)
        cout<<"Sagittarius";
    else if(month<=12 && date<=21)
        cout<<"Sagittarius";
    else if(month<=12 && date>=22)
        cout<<"Capricon";
    else if(month<=1 && date<=19)
        cout<<"Capricon";
    else
        cout<<"Invalid Month:";

    getch();
}

Atm machine program picture in c++


ATM machine in C++


#include  <iostream>
#include  <conio.h>
#include <stdlib.h>
using namespace std;
class Customer {    
   char name[20];
     int p,q;
    char city[20];  
   char v[10];
  int n;
  public:  
  Customer(int a) { p=a;        
        }    
  int getdata() {  
cout << "\nEnter your name: ";  
cin >> name;  
cout << "\nEnter your city: "; cin >> city;          
 cout << "\nEnter current account balance: "; cin >> p;
 cout << "\nEnter account type:"; cin>>v;
 cout << "\n Set your password: "; cin>>q;   }
  int deposit() {         int dep;    
 cout << "\nEnter amount to be deposited: ";  
cin >> dep;         p=p + dep;      }  
 int withdraw() {         int wdraw;    
  cout << "\nEnter amount to be withdrawn: ";
cin >> wdraw;         p=p - wdraw;      }  
int showdata() {    int n; cout << "\nEnter pasword: ";            cin >> n;   if (n==10)
{ cout<<"Name:Asim wadood";
cout<<"\nAccount Balance: Rs."<<p;
cout<<"\nAccount type: current";
cout << "\nCity: " <<"kohat";}
if (n==11)
{cout<<"name:ayaz haider";
cout<<"\nAccount Balance: Rs."<<p;
cout<<"\nAccount type: current";
cout << "\nCity: " << "kohat";}
if (n==12)
{ cout<<"name:Abid shah";
cout<<"\nAccount Balance: Rs."<<p;
cout<<"\nAccount type: fixed";
cout << "\nCity: " << "kohat";}
if (n==13)
{ cout<<"name:Abdul hameed";
cout<<"\nAccount Balance: Rs."<<p;
cout<<"\nAccount type: current";
cout << "\nCity: " << "kohat";}
if (n==q)
{cout << "\nEnter your name: "<<name;  
cout << "\nEnter your city: "<<city;          
 cout << "\nEnter current account balance: "<<p;
 cout << "\nEnter account type:"<<v;
   }
         
 }
  }; int main() {    char choice;   int z = 0;
     
 Customer cust(1000);    while (z == 0) {
          cout<<"\n*********WELCOME TO ASIM BANK ACCOUNT SYSTEM***********\n\n";
  cout << "\n\t" << "Main Menu";    
 cout << "\n\t" << "Select by letter:";
 cout << "\n\t" << "a - Add a customer.";    
 cout << "\n\t" << "d - Deposit money.";    
 cout << "\n\t" << "w - Withdraw money.";  
cout << "\n\t" << "s - Show Account Information.";    
cout << "\n\t" << "q - Quit Application.\n\n";  
cout  << "Choice: ";  
choice = getch();      switch(choice) {         case 'a':        
         system("cls");      int n;            
cust.getdata();      
system("cls");        
break;    
case 'd':  
 system("cls");    
cout << "\nEnter password: ";      
cin >> n;            cust.deposit();  
system("cls");            break;          case 'w':  
system("cls");      
cout << "\nEnter password: ";        
cin >> n;            cust.withdraw();      
system("cls");            break;        
case 's':          
     system("cls");
cust.showdata();      
   getch();            system("cls");    
break;          case 'q':      
                    z = 1;            break;    
 default:          
 cout << "\nInvalid selection. Press a key to return to main menu.";    
 getch();      }  
   if (z == 1)
 {         break;  
 }    }
return 0;}
Add caption