You are on page 1of 3

Password 2

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

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

bool password()
{
char pas[10];
cout<<"\n\n\t\t\t\tEnter your Password.... ";
cin>>pas;
if(strcmp(pas,"farhan")){
cout<<"\n\t\t\t--------- Access was Denied ---------";
return false;
}
return true;
}

void addition()
{
int x,y;
cout<<"\n\n\t\t\t\tEnter the 1st no = ";
cin>>x;
cout<<"\n\n\t\t\t\tEnter the 2nd no = ";
cin>>y;
cout<<"\n\n\t\t\t\tResult = "<<x+y;
}

void subtraction()
{
int x,y;
cout<<"\n\n\t\t\t\tEnter the 1st no = ";
cin>>x;
cout<<"\n\n\t\t\t\tEnter the 2nd no = ";
cin>>y;
cout<<"\n\n\t\t\t\tResult = "<<x-y;
}

void main(){

int op;
do{

cout<<"\n\n\n\n\n\n\n\t\t\t\t[1]-Enter in the
Program";
cout<<"\n\n\t\t\t\t[2]-Exit";
cout<<"\n\n\t\t\t\tYour Choice.... ";
cin>>op;

if(op==1){
if(password()){

cout<<"\n\t\t\t--------- Password Accepted ---


------\n";
system("cls");
int op;
do{

cout<<"\n\n\t\t\t\t[1]-Addition";
cout<<"\n\n\t\t\t\t[2]-Subtrction";
cout<<"\n\n\t\t\t\t[3]-Up";
cout<<"\n\n\t\t\t\tYour Choice.... ";
cin>>op;

if(op==1){
system("cls");
cout<<"\n\t\t\t ---------
ADDITION ---------\n";
addition();
}
else
if(op==2){
system("cls");
cout<<"\n\t\t\t ---------
SUBTRACTION ---------\n";
subtraction();
}
else
if(op==3){
break;
}
cout.flush();
getch();
system("cls");
}while(op!=3);
}
else{

cout<<"\n\t\t\t--------- Invalid
Password! ---------\n";

} // 1st Level [1]


else
if(op==2)
exit(0);
cout.flush();
getch();
system("cls");
}while(op!=2);

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