hi......... i want a program of scientific calcultor in assembly languge........if anyone havr plx share i really need it Regards RedAngel
Code: //try this code....^_~ #include void ssc(); void sci(); void main() { //declaration int num1,num2; char ope[4]; //clearing the screen clrscr(); //printing welcome message printf("\t\t\t\t***CALCULATOR***\n\tFor help: type help\n"); start: cin>>ope; if(strcmp(ope,"end")==0) goto end; else if(strcmp(ope,"help")==0) { printf("\n\nTo do calculations you must first know the keyword for the specific calculation\nfor,\n\taddition - add\n\tsubtraction - sub\n\tdivision - div\n\tmultiplication - mul\n\treminder - rem\n\tclose calculator - end\n\tTo switch to scientific calculator mode - sci\tIn scientific calculator mode you can get sin,cos,tan and log values.\n\tsuccessive calculating mode - ssc\n\tYou must specify the keyword and the two numbers separated by space\n"); goto start; } else if(strcmp(ope,"sci")==0) { sci(); goto start; } else if(strcmp(ope,"ssc")==0) { ssc(); goto start; } else if(strcmp(ope,"clr")==0) { clrscr(); cout<<"\t\t\t\t***CALCULATOR***\n"; goto start; } cin>>num1>>num2; if(strcmp(ope,"add")==0) printf("The sum of %d and %d is %d\n",num1,num2,num1+num2); else if(strcmp(ope,"sub")==0) printf("The difference between %d and %d is %d\n",num1,num2,num1-num2); else if(strcmp(ope,"mul")==0) printf("The product of %d and %d is %d\n",num1,num2,num1*num2); else if(strcmp(ope,"div")==0) printf("The qoutient on dividing %d by %d is %d\n",num1,num2,num1/num2); else if(strcmp(ope,"rem")==0) printf("The reminder on divindin %d by %d is %d\n",num1,num2,num1%num2); else printf("Invalid command only keywords available are add,sub,mul,div,rem.\n"); goto start; end: } void sci() { //declaration char ope[3]; int num1; start: cin>>ope; if(strcmp(ope,"end")==0) goto end; cin>>num1; if(strcmp(ope,"sin")==0) printf("The sin value of %d is %d\n",num1,sin(num1)); else if(strcmp(ope,"cos")==0) printf("The cos value of %d is %d\n",num1,cos(num1)); else if(strcmp(ope,"tan")==0) printf("The tangent value of %d is %d\n",num1,tan(num1)); else if(strcmp(ope,"log")==0) printf("The log value of %d is %d\n",num1,log(num1)); else printf("Invalid command only keywords available are sin,cos,tan and log.\n"); goto start; end: cout<<"You are now leaving the scientific calculator. To return to scientific calculator mode type sci.\n"; } void ssc() { //declaration char ope[3]; int result,num1; cout<<"Enter the first value:"; cin>>result; start: cin>>ope; if(strcmp(ope,"end")==0) goto end; cin>>num1; if(strcmp(ope,"add")==0) result=result+num1; else if(strcmp(ope,"sub")==0) result=result-num1; else if(strcmp(ope,"div")==0) result=result/num1; else if(strcmp(ope,"mul")==0) result=result*num1; else printf("Invalid command only available keywords are add,sub,mul,div\n"); printf("For now the result is %d\n",result); goto start; end: cout<<"Now you exiting the succesive calculating mode\n"; }
That isn't assembly language; that's C. It also won't compile due to an error on line 1 (you didn't tell the preprocess what to include).
A simple google search does the job :- http://read.pudn.com/downloads78/sourcecode/asm/299415/Calculator.asm__.htm