Tuesday, December 27, 2011

MY PROGRAM


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

void getInp(char *inp )
 {
    char ch;

    int i=0;
      ch=getch();
    while(ch != '\r')
    {
     inp[i++] = ch;
     cout << "*";
     ch = getch();
    }
    inp[i] = '\0';
 }
void main()
{
clrscr();
float unamt,amt;
int hp,a,c1,c2;                                    //hp is for switch caes ;a is for password cases;c1 is for un1
char x, un[15];  //un is for username
do
{
clrscr();
textcolor(GREEN);
cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b                                  HOME PAGE  ");
textcolor(BROWN+BLINK);
cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t#--*--*--*--*--*--*--*--*--*--*--*--#\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t ");
textcolor(WHITE);
cout<<"\n Welcome to SHRISHAVAM BANK ";
cout<<"\n You are in the bank where quality is guaranted";
cout<<"\n To go to home page press 1 ";
cout<<"\n To login press 2";
cout<<"\n to go to contact us press 3";
cout<<"\n To exit press 4";
cout<<"\n enter your choice";
cin>>hp;
switch(hp)
  {
case(1):clrscr();
x='a';
break;
case(2):clrscr();
x='b';
cout<<"\nYou are in login page";
cout<<"\nEnter username ";
cin>>un;
if(un[0]=='a'&&un[1]=='s'&&un[2]=='i'&&un[3]=='m')
    {                                                 //begining of if case
unamt=10000;

char pw[15];

a=1;
    do{

cout<<"\n enter password you have  "<<5-a<<" tries :";
getInp(pw);


if (pw[0]=='a'&&pw[1]=='s'&&pw[2]=='i'&&pw[3]=='m'&&pw[4]=='1'&&pw[5]=='2')
  {
cout<<"\ncorrect password";

getch();
do{
clrscr();
cout<<"Welcome  "<<un;
cout<<"\n To check your profile press  1";
cout<<"\n To withdraw amount press 2";
cout<<"\n To deposit amount press 3";
cout<<"\n To go back press 4";
cout<<"\n To go to home page press 5 ";
cout<<"\n To exit press 6";
cout<<"\n\n ENTER YOUR CHOICE   : ";
cin>>c1;
switch(c1)
{
case(1):clrscr();
cout<<"\nName:Asim Krishna Prasad";
cout<<"\nAmount in bank : "<<unamt;
cout<<"\nTo go back press 1";
cout<<"\nto exit press any other key";

cout<<"\n Your choice   __  ";
cin>>c2;
if(c2==1)
  x='k';
else
exit(1);
break;
case(2):clrscr();
cout<<"\nEnter the amount u want to withdraw ";
cin>>amt;
unamt=unamt-amt;
cout<<"your new amount is"<<unamt;
break;
case(3):clrscr();
cout<<"\n Enter the amount to deposit :";
cin>>amt;
unamt=unamt+amt;
cout<<"your new amount is :"<<unamt;
break;
case(4):clrscr();
x='k';
break;
case(5):clrscr();
x='a';
break;
case(6):exit(1);
break;
default:clrscr();
cout<<"wrong choice";
cout<<"try again";
x='k';
getch();




}
}
while(x=='k');
     //a=1 is used to dissatisfy the while case

  a=1;
  }
else

  {
cout<<"\nincorrect";
a=a+1;     //a=a+1 is used to limit the while case
  }
}
   while((a<=4)&&(a>=2));
if(a==5)
{
cout<<"\n\n\n\t\tyour tries are over" ;
getch();
exit(1);
}
     }
    //end of if username1
else if(un[0]=='r'&&un[1]=='i'&&un[2]=='s'&&un[3]=='h'&&un[4]=='a'&&un[5]=='v')
     {
char pw[15];
unamt=21000;
a=1;
    do{

cout<<"\n enter password you have  "<<5-a<<" tries :";
getInp(pw);


if (pw[0]=='r'&&pw[1]=='i'&&pw[2]=='s'&&pw[3]=='h'&&pw[4]=='a'&&pw[5]=='v')
  {
cout<<"\ncorrect password";
getch();
do{
clrscr();
cout<<"Welcome  "<<un;
cout<<"\n To check your profile press  1";
cout<<"\n To withdraw amount press 2";
cout<<"\n To deposit amount press 3";
cout<<"\n To go back press 4";
cout<<"\n To go to home page press 5 ";
cout<<"\n To exit press 6";
cout<<"\n\n ENTER YOUR CHOICE   : ";
cin>>c1;
switch(c1)
{
case(1):clrscr();
cout<<"\nName:Rishav Kashyap";
cout<<"\nAmount in bank : "<<unamt;
cout<<"\nTo go back press 1";
cout<<"\nto exit press any other key";

cout<<"\n  Your choice  ";
cin>>c2;
if(c2==1)
  x='k';
else
exit(1);
break;
case(2):clrscr();
cout<<"\nEnter the amount u want to withdraw ";
cin>>amt;
unamt=unamt-amt;
cout<<"your new amount is"<<unamt;
break;
case(3):clrscr();
cout<<"\n Enter the amount to deposit :";
cin>>amt;
unamt=unamt+amt;
cout<<"your new amount is :"<<unamt;
break;
case(4):clrscr();
x='k';
break;
case(5):clrscr();
x='a';
break;
case(6):exit(1);
break;
default:clrscr();
cout<<"wrong choice";
cout<<"try again";
x='k';
getch();




}
}
while(x=='k');

a=1;                                                                       //a=1 is used to dissatisfy the while case
  }
else
  {
cout<<"\nincorrect";
a=a+1;     //a=a+1 is used to limit the while case
  }
}
   while((a<=4)&&(a>=2));
if(a==5)
{
cout<<"\n\n\n\t\tyour tries are over" ;
getch();
exit(1);
}

     }
else if (un[0]=='s'&&un[1]=='r'&&un[2]=='i'&&un[3]=='m'&&un[4]=='a'&&un[5]=='n')
{
char pw[15];
unamt=51000;
a=1;
    do{

cout<<"\n enter password you have  "<<5-a<<" tries :";
getInp(pw);


if (pw[0]=='c'&&pw[1]=='o'&&pw[2]=='o'&&pw[3]=='l'&&pw[4]=='1'&&pw[5]=='9'&&pw[6]=='2')
  {
cout<<"\ncorrect password";
getch();
do{
clrscr();
cout<<"Welcome  "<<un;
cout<<"\n To check your profile press  1";
cout<<"\n To withdraw amount press 2";
cout<<"\n To deposit amount press 3";
cout<<"\n To go back press 4";
cout<<"\n To go to home page press 5 ";
cout<<"\n To exit press 6";
cout<<"\n\n ENTER YOUR CHOICE   : ";
cin>>c1;
switch(c1)
{
case(1):clrscr();
cout<<"\nName:Sriman sawarthia";
cout<<"\nAmount in bank : "<<unamt;
cout<<"\nTo go back press 1";
cout<<"\nto exit press any other key";

cout<<"\n  your chice  ";
cin>>c2;
if(c2==1)
  x='k';
else
exit(1);
break;
case(2):clrscr();
cout<<"\nEnter the amount u want to withdraw ";
cin>>amt;
unamt=unamt-amt;
cout<<"your new amount is"<<unamt;
break;
case(3):clrscr();
cout<<"\n Enter the amount to deposit :";
cin>>amt;
unamt=unamt+amt;
cout<<"your new amount is :"<<unamt;
break;
case(4):clrscr();
x='k';
break;
case(5):clrscr();
x='a';
break;
case(6):exit(1);
break;
default:clrscr();
cout<<"wrong choice";
cout<<"try again";
x='k';
getch();




}
}
while(x=='k');


a=1;                                                                       //a=1 is used to dissatisfy the while case
  }
else
  {
cout<<"\nincorrect";
a=a+1;     //a=a+1 is used to limit the while case
  }
}
   while((a<=4)&&(a>=2));
if(a==5)
{
cout<<"\n\n\n\t\tyour tries are over" ;
getch();
exit(1);
}
}
break;
       case(3):
clrscr();
x='l';
textcolor(GREEN);
cprintf("\nCONTACT US");
textcolor(WHITE);
cout<<"\nPhone no: 9808412222";
cout<<"\nEmail ID: 123@fb.com";

break;
case(4):
exit(1);
break;
default:
clrscr();
cout<<"try again";
cout<<"\n ";
getch();
x='a';
break;
       }
}//do loop for home page
       while(x=='a');
getch();
exit(1);

}

No comments:

Post a Comment