Documente Academic
Documente Profesional
Documente Cultură
#include <math.h>
#include <conio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream.h>
return no1+no2;
return no1-no2;
return no1*no2;
return no1/no2;
angle=(3.14159*angle)/180;
return tan(angle);
}
bool password(){
char pas[10];
system("cls");
cout<<"\n\n\n\n\n\n\n\n\t\t\tEnter the Password.... ";
cin>>pas;
if(strcmp(pas,"farhan")){
system("cls");
cout<<"\n\n\n\n\n\n\n\n\n\t\t\t Access was Denied";
return false;
}
return true;
}
void menue(){
int op;
do{
cout<<"--------------------------- Menue Driven Calculator
---------------------------";
cout<<"\n--------------\t\t By Muhammad Farhan Saleem
\t\t---------------";
cout<<"\n--------------------------- PF 1st Semester
---------------------------";
cout<<"\n\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 && op!=2){
system("cls");
cout<<"\n\n\n\n\n\n\n\n\n\t\t\t\tInvalid Option";
}
else
if(op==1){
if(password()){
system("cls");
cout<<"\n\t\t =============
Password Accepted =============\n";
int ch;
do{
cout<<"\n\n\n\n\t\t\t\t[1]- Simple
Calculator";
cout<<"\n\n\t\t\t\t[2]- Scientific
Calculator";
cout<<"\n\n\t\t\t\t[3]- Up";
cout<<"\n\n\t\t\t\tYour Choice.... ";
cin>>ch;
/* =====================
Simple Calculator ===================== */
else
if(ch==1){
system("cls");
int op;
do{
cout<<"\n\t\t
============= Simple Calculator =============";
cout<<"\n\n\n\n\n\n\n\n\n\t\t\t\tInvalid Option";
}
else
if(op==1){
system("cls");
float
no1,no2;
cout<<"\n\n\t\t\t============= Addition
=============";
system("cls");
cout<<"\n\n\t\t\t============= Addition
=============";
cout<<"\n\n\n\t\t\t\t -----------------------";
cout<<"\n\t\t\t\t -----------------------";
}
else
if(op==2){
cout<<"\n\n\t\t\t============= Subtraction
=============";
system("cls");
float
no1,no2;
system("cls");
cout<<"\n\n\t\t\t============= Subtraction
=============";
cout<<"\n\n\n\t\t\t\t -----------------------";
cout<<"\n\t\t\t\t -----------------------";
}
else
if(op==3){
system("cls");
float
no1,no2;
cout<<"\n\n\t\t\t============= Multiplication
=============";
system("cls");
cout<<"\n\n\t\t\t============= Multiplication
=============";
cout<<"\n\n\n\t\t\t\t -----------------------";
cout<<"\n\t\t\t\t -----------------------";
}
else
if(op==4){
system("cls");
float
no1,no2;
cout<<"\n\n\t\t\t============= Division
=============";
system("cls");
cout<<"\n\n\t\t\t============= Division
=============";
cout<<"\n\n\n\t\t\t\t -----------------------";
cout<<"\n\t\t\t\t -----------------------";
}
else
if(no2==0){
system("cls");
cout<<"\n\n\t\t\t============= Division
=============";
cout<<"\n\n\n\t\t\t\t -----------------------";
cout<<"\n\t\t\t\t\tUndefined";
cout<<"\n\t\t\t\t -----------------------";
}
}
else
if(op==5){
system("cls");
int no1,no2;
cout<<"\n\n\t\t\t============= Remainder
=============";
system("cls");
cout<<"\n\n\t\t\t============= Remainder
=============";
cout<<"\n\n\n\t\t\t\t -----------------------";
/* =====================
Scientific Calculator ===================== */
else
if(ch==2){
system("cls");
int op;
do{
cout<<"\n\t\t
============= Scientific Calculator =============";
system("cls");
cout<<"\n\n\n\n\n\n\n\n\n\t\t\t\tInvalid Option";
}
else
if(op==1){
double
angle;
system("cls");
cin>>angle;
system("cls");
cout<<"\n\n\n\t\t\t -----------------------------";
cout<<"\n\t\t\t -----------------------------";
}
else
if(op==2){
double
angle;
system("cls");
cin>>angle;
system("cls");
cout<<"\n\n\n\t\t\t -----------------------------";
cout<<"\n\t\t\t -----------------------------";
}
else
if(op==3){
double
angle;
system("cls");
cout<<"\n\n\t\t\t============= Tangent
=============";
cin>>angle;
system("cls");
cout<<"\n\n\t\t\t============= Tangent
=============";
cout<<"\n\n\n\t\t\t -----------------------------";
cout<<"\n\t\t\t -----------------------------";
}
else
if(op==4){
double
angle;
system("cls");
cin>>angle;
system("cls");
cout<<"\n\n\n\t\t\t -----------------------------";
cout<<"\n\t\t\t Result of Angle "<<angle<<" = "<<getSec(angle);
cout<<"\n\t\t\t -----------------------------";
}
else
if(op==5){
double
angle;
system("cls");
cout<<"\n\n\t\t\t============= Cosecant
=============";
cin>>angle;
system("cls");
cout<<"\n\n\t\t\t============= Cosecant
=============";
cout<<"\n\n\n\t\t\t -----------------------------";
cout<<"\n\t\t\t -----------------------------";
}
else
if(op==6){
double
angle;
system("cls");
cout<<"\n\n\t\t\t============= Cotangent
=============";
cin>>angle;
system("cls");
cout<<"\n\n\t\t\t============= Cotangent
=============";
cout<<"\n\n\n\t\t\t -----------------------------";
cout<<"\n\t\t\t -----------------------------";
}
else if(op==7){
break;
}
cout.flush();
getch();
system("cls");
}while(ch!=7); // -----
Nested Loop ScCal -----
}
else
if(ch==3)
break;
cout.flush();
getch();
system("cls");
}while(ch!=3);// -----
Nested Loop_1 -----
}
else
cout<<"\n\t\t\t Inavlid
Password!";
}
else
if(op==2){
cout.flush();
system("cls");
cout<<"\n\n\n\n\n\n\n\n\n--------------------------- Muhammad
Farhan Saleem ----------------------------";
cout<<"\n--------------\t\t
farhan.saleem@hotmail.com \t\t---------------";
cout<<"\n--------------------------- 03008855006
----------------------------\n\n\n\n\n\n\n";
exit(0);
}
cout.flush();
getch();
system("cls");
}while(op!=2);// ----- End of Outer
While Loop -----
} // ---- End of Menue ----
void main()
{
menue();
}
URL: http://ravianeducation.blogspot.com
E-Mail: mail2ravian@gmail.com
Farhan: 03008855006
farhan.saleem@hotmail.com
farhan.saleem26@yahoo.com