Anda di halaman 1dari 15

=

SCENTIFIC CALCULATOR

CERTIFICATE
This is to certify that AMIT KUMAR of class XII - A has completed the chemistry project entitled SCENTIFIC CALCULATOR himself and under my guidance. The progress of the project has been continuously reported and has been in my knowledge consistently.

TEACHER
(Subject teacher)

SOURCE CODE
#include<math.h> #include<iostream.h> #include<conio.h> #include<graphics.h> #include<dos.h> #include <stdlib.h> #include <stdio.h> void main() { clrscr(); int x,y; int gdriver = EGA, gmode = EGAHI; char msg[80]; initgraph(&gdriver, &gmode, ""); settextjustify(CENTER_TEXT, CENTER_TEXT); x = getmaxx() / 2; y = getmaxy() / 2;

/*+++++++++++++++++++++++++++++++++end_of_page_1+++ ++++++++++++++*/ cleardevice(); sprintf(msg, "welcom to calculator"); outtextxy(x, y, msg); setbkcolor(1);

getch(); delay(500); /*++++++++++++++++++++++++++++++++++++++++++eop_2+ +++++++++++++++++++*/ cleardevice(); setbkcolor(1); cout<<'\t'<<" Enter 1 for continue or 0 for exit\n "; cout<<"\t waiting for your answer :\t"; int a; cin>>a; if(a==0) exit(0); else /*+++++++++++++++++++++++++++++++++++++++++++eop3+ +++++++++++++++++++*/ cleardevice(); cout<<" Starting sevices"; for(int i=0;i<10;i++) { cout<<"."; delay(200); } /*++++++++++++++++++++++++++++++++++++++++++++eop4 +++++++++++++++++++*/ cleardevice();

cout<<"Calculator Activated"<<'\n'<<"Loading Directories"; for(int j=0;j<10;j++) { cout<<"."; delay(200); } again:; p2:; cout<<"\n\t\t\t"<<"________________________\n"; cout<<"\t\t\t"<<"|| 1.SUM ||\n"; cout<<"\t\t\t"<<"|| 2.SUBTRACT ||\n"; cout<<"\t\t\t"<<"|| 3.MULTIPLY ||\n"; cout<<"\t\t\t"<<"|| 4.DIVIDE ||\n"; cout<<"\t\t\t"<<"|| 5.PERCENTAGE ||\n"; cout<<"\t\t\t"<<"|| 6.SQUARE ROOT ||\n"; cout<<"\t\t\t"<<"|| 7.FACTORIAL ||\n"; cout<<"\t\t\t"<<"|| 8.MORE FUNCTION ||\n"; cout<<"\t\t\t"<<"|| 0.EXIT ||\n"; cout<<"\t\t\t"<<"________________________"; cout<<'\n'<<"ENTER YOUR CHOICE :"; int choice; cin>>choice; /*==========================================eop5++ ++++++++++++++++++++====*/ clrscr(); cleardevice(); gotoxy(0,0);

cout<<"\n\t\t\t"<<"CALCULATION AREA\n"; int fact(float); switch(choice) { case 1 : cout<< "ENTER TWO NUMBERS TO BE ADDED:\n"; float a1,a2; cout<<"\n FIRST NUMBER\t :";cin>>a1; cout<<"\n SECOND NUMBER\t:";cin>>a2; cout<<"\n SUM IS :"<<a1+a2; cout<<"\n GOING TO PREVIOUS SCREEN"; delay(500); clrscr();cleardevice(); goto again; case 2 : cout<< "ENTER TWO NUBER TO BE SUBTRACT:\n"; float s1,s2; cout<<"\n FIRST NUMBER\t :";cin>>s1; cout<<"\n SECOND NUMBER\t:";cin>>s2; cout<<"\n Subtraction IS :"<<s1-s2; cout<<"\n GOING TO PREVIOUS SCREEN"; delay(500);clrscr();cleardevice(); goto again; case 3 : cout<< "ENTER TWO NUMBERS TO BE MULTIPLIED:\n"; float m1,m2; cout<<"\n FIRST NUMBER\t :";cin>>m1;

cout<<"\n SECOND NUMBER\t:";cin>>m2; cout<<"\n PRODUCT IS :"<<m1*m2; cout<<"\n GOING TO PREVIOUS SCREEN"; delay(500);clrscr();cleardevice(); goto again; case 4: cout<< "ENTER TWO NUMBERS TO BE DIVIDED:\n"; float D1,D2; cout<<"\n FIRST NUMBER\t :";cin>>D1; cout<<"\n SECOND NUMBER\t:";cin>>D2; cout<<"\n RESULT IS :"<<D1/D2; cout<<"\n GOING TO PREVIOUS SCREEN"; delay(500);clrscr();cleardevice(); goto again; case 5 : cout<<"ENTER NUMBER FOR WHICH PECENTAGE TO BE OBTAINED"; float p1,p2; cout<<"\n FIRST NUMBER\t :";cin>>p1; cout<<"\n ToTAL\t :";cin>>p2; cout<<"\n RESULT IS :"<<(p1/p2)*100<<"%"; cout<<"\n GOING TO PREVIOUS SCREEN"; delay(500);clrscr();cleardevice(); goto again; case 6 :cout<<"ENTER NUMBER:\t "; float s; cin>>s;

cout<<"\n RESULT IS :"<<pow(s,0.5); cout<<"\n GOING TO PREVIOUS SCREEN"; delay(500);clrscr();cleardevice(); goto again; case 7 :cout<<" ENTER NUMBER\t :"; float f;cin>>f; cout<<"\n RESULT IS :"<<fact(f); cout<<"\n GOING TO PREVIOUS SCREEN"; delay(500);clrscr();cleardevice(); goto again; case 8 :break; case 0 :cout<<"GOOD bye"; delay(1000); exit(0); default: cout<<"wrong choice"; delay(500);clrscr();cleardevice(); goto again; } void flog(void); void trig(void); void inverse(void); void antilog(void); clrscr(); cleardevice(); gotoxy(20,3); cout<<"$ FOLLOWING ARE OTHER FUNCTIONS $";

gotoxy(22,4); cout<<"+_________________________+"; gotoxy(22,5); cout<<"||\t1.LOG FUNCTION ||"; gotoxy(22,6); cout<<"||\t2.TIRIGNOMETRIC Fxn ||"; gotoxy(22,7); cout<<"||\t3.INVERSE TRIG. Fxn ||"; gotoxy(22,8); cout<<"||\t4.ANTILOG FUNCTION ||"; gotoxy(22,9); cout<<"||\t5.EXPONENTION Fxn ||"; gotoxy(22,10); cout<<"||\t6.PREVIOUS PAGE ||"; gotoxy(22,11); cout<<"+_________________________+"; cout<<"\nENTER CHOICE\t;"; int ch2; cin>> ch2; switch(ch2) { case 1 : cout<<"\n\t 2 FUNCTION ARE HERE\n "; flog(); cout<<"Going to previous screen"; delay(4000);clrscr();cleardevice(); goto p2; case 2 : cout<<"\n\t 3 FUNCTION ARE HERE\n ";

trig(); cout<<"Going to previous screen"; delay(4000);clrscr();cleardevice(); goto p2; case 3 : cout<<"\n\t 3 FUNCTION ARE HERE\n "; inverse(); cout<<"Going to previous screen"; delay(4000);clrscr();cleardevice(); goto p2; case 4 : cout<<"\n\t 2 FUNCTION ARE HERE\n "; antilog(); cout<<"Going to previous screen"; delay(4000);clrscr();cleardevice(); goto p2; case 5 : clrscr();cleardevice(); cout<<"ENTER NUMBER\t:"; float n1,p; cin>>n1; cout<<"\nENTER POWER OF NUMBER\t:"; cin>>p; cout<<"\nRESULT IS\t:"<<pow(n1,p); cout<<"Going to previous screen"; delay(4000);clrscr();cleardevice(); goto p2; case 6 : cleardevice();clrscr(); goto p2; default: cout<<"Wrong choice";

cout<<"Going to previous screen"; delay(4000);clrscr();cleardevice(); goto p2; }

} void flog() { clrscr();cleardevice(); cout<<"\t1.NATURAL LOG\n"; cout<<"\t2.LOG BASE 10\n"; cout<<"\n\tENTER CHOICE\t:"; int c; cin>>c; switch(c) { case 1 :cout<<"ENTER NUMBER\t:"; int a;cin>>a; cout<<"\nRESULT IS\t:"<<log(a); break; case 2 :cout<<"ENTER NUMBER\t:"; int b;cin>>b; cout<<"\nRESULT IS\t:"<<log10(b); break; default: cout<<"wrong choice"; break; } } void trig()

{ clrscr();cleardevice(); cout<<"\t1.SINE\n"<<"\t2.COSINE\n"<<"\t3.COSECANT\n"<<"\ t4.SECANT\N"<<"\t5.TAN\n"<<"\t6.COT\n"; int c; cout<<"\nENTER CHOICE\t :"; cin>>c; clrscr(); cleardevice(); switch(c) { case 1 :cout<<"ENTER NUMBER\t:"; int a;cin>>a; cout<<"\nRESULT IS\t:"<<sin(a); break; case 2 :cout<<"ENTER NUMBER\t:"; int b;cin>>b; cout<<"\nRESULT IS\t:"<<cos(b); break; case 3 :cout<<"ENTER NUMBER\t:"; int d;cin>>d; cout<<"\nRESULT IS\t:"<<(1/sin(d)); break; case 4 :cout<<"ENTER NUMBER\t:"; int e;cin>>e; cout<<"\nRESULT IS\t:"<<(1/cos(e)); break; case 5 :cout<<"ENTER NUMBER\t:"; int f;cin>>f;

cout<<"\nRESULT IS\t:"<<tan(f); break; case 6 :cout<<"ENTER NUMBER\t:"; int g;cin>>g; cout<<"\nRESULT IS\t:"<<(1/tan(g)); break; default: cout<<"wrong choice"; break;

} } void inverse() { clrscr();cleardevice(); cout<<"\t1.SINE\n"<<"\t2.COSINE\n"<<"\t3.TAN\n"; int c; cout<<"ENTER CHOICE\t :"; cin>>c; switch(c) { case 1 :cout<<"ENTER NUMBER\t:"; int a;cin>>a; cout<<"\nRESULT IS\t:"<<asin(a); break; case 2 :cout<<"ENTER NUMBER\t:"; int b;cin>>b; cout<<"\nRESULT IS\t:"<<acos(b); break;

case 3 :cout<<"ENTER NUMBER\t:"; int f;cin>>f; cout<<"\nRESULT IS\t:"<<atan(f); break; default: cout<<"wrong choice"; break;

} } void antilog() { clrscr();cleardevice(); cout<<"\t1.NATURAL ANTILOG\n"; cout<<"\t2.ANTILOG BASE 10\n"; cout<<"\n\tENTER CHOICE\t:"; int c; cin>>c; switch(c) { case 1 :cout<<"ENTER NUMBER\t:"; int a;cin>>a; cout<<"\nRESULT IS\t:"<<exp(a); break; case 2 :cout<<"ENTER NUMBER\t:"; int b;cin>>b; cout<<"\nRESULT IS\t:"<<pow(10,b); break; default: cout<<"wrong choice"; break; }

int fact(float s) { float z; if(s==0) { return(1);} else z=s*fact(s-1); return(z); }

Anda mungkin juga menyukai