Sunteți pe pagina 1din 3

Password 1

============================================

#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream.h>

bool Password(){

char str[20];
cout<<"\nEnter the Password ";
cout.flush();
gets(str);
if(strcmp(str,"farhan")){
cout<<"\nAcces was denied";
return false;
}

return true;
}

int sum(int x, int y)


{return x+y;}

int sub(int x, int y)


{return x-y;}

void main(){
int ch;
do{
cout<<"\n[1] - Enter in the Programme";
cout<<"\n[2] - Exit";
cout<<"\nEnter yr choice: ";
cin>>ch;
switch(ch){
case 1:
{
system("cls");
if(Password()){
cout<<"\n
************************** Logged on Successfully
**************************\n";
do{
int ch;
system("cls");
cout<<"\n[1] - Add";
cout<<"\n[2] - Sub";
cout<<"\n[3] - Home";
cout<<"\nEnter yr choice: ";
cin>>ch;

if(ch==1){

system("cls");
int n1,n2,temp;
cout<<"\nEnter the
1st no = ";
cin>>n1;
cout<<"\nEnter the
2nd no = ";
cin>>n2;
temp=sum(n1,n2);
cout<<"\n\nSum =
"<<temp;

}
if(ch==2){
system("cls");
int n1,n2,temp;
cout<<"\nEnter the
1st no = ";
cin>>n1;
cout<<"\nEnter the
2nd no = ";
cin>>n2;
temp=sub(n1,n2);
cout<<"\n\nSub =
"<<temp;

if(ch==3){
ch=0;
break;
}
cout.flush();
getch();
system("cls");
}while(ch!=3);
}
else{
system("cls");
cout<<"\nInvalid Password !";
}

break;

} /* CASE!1: ENDED */

case 2:
exit(0);

default:
cout<<"\nInvalid Option";

}
cout.flush();
getch();
system("cls");
}while(ch!=2);
}

http://www.ravianeducation.blogspot.com
FARHAN: 03008855006

S-ar putea să vă placă și