Thursday, April 2, 2009

Swollen Ankles While Drinking Alcohol

scientific calculator

One of the companions made a calculator that includes a bit more than called for in the lab ... check it out and hopefully comments ...

Daniel says:
This is a scientific calculator made switch. Because it includes mathematical functions such as potentiation, sine, cosine, tangent, it is important to include the math.h library, besides the iostream.
then the code.


< iostream> # include # include
< math.h>
using namespace std;
double a, b, c;
int d, e, f, g;
char sign;
int main () {
cout << "CALCULADORA\n\n";
cout << "Ingrese los dos numeros y el signo de la operación aritmetica que desea realizar.\n";
cout << "Permite realizar:\n";
cout << "Suma(+), Resta(-), Multiplicación(*), División(/),Division entera(%), Potenciación(p), Radicación(r), Seno (s), Coseno (c) y Tangente (t).";
cout << "Escriba el simbolo indicado entre parentesis, segun sea la operación que usted desea realizar: ";
cin >> signo;
switch (signo){
case '+':{
cout <<"\nSUMAR\n\n";
cout << "Ingrese el primer sumando: ";
cin>>a;
cout << "Ingrese el segundo sumando: ";
cin>>b;
c=a+b;
cout << a<<"+"<< b<<"=>
break;
}
case '-':{
cout <<"\nRESTAR\n\n";
cout << "Ingrese el minuendo: ";
cin>>a;
cout << "Ingrese el sustraendo: ";
cin>>b;
c=a-b;
cout << a<<"-"<< b<<"=>
break;
}
case '*':{
cout <<"\nMULTIPLICAR\n\n";
cout << "Ingrese el primer factor: ";
cin>>a;
cout << "Ingrese el segundo factor: ";
cin>>b;
c=a*b;
cout << a<<"*"<< b<<"=>
break;
}
case '/':{
cout <<"\nDIVIDIR\n\n";
cout << "Ingrese el dividendo: ";
cin>>a;
cout << "Ingrese el divisor: ";
cin>>b;
c=a/b;
cout << a<<"/"<< b<<"=>
break;
}
case '%':{
cout <<"\nDIVISION ENTERA\n\n";
cout << "Ingrese el dividendo: ";
cin>>d;
cout << "Ingrese el divisor: ";
cin>>e;
f=d%e;
g=(d-f)/e;
cout << d<<"/"<< e<<"=>
cout <<" El residuo es: "<
break;
}
case 'p':{
cout <<"\nPOTENCIACION\n\n"
;
cout << "Ingrese la base: ";
cin>>a;
cout << "Ingrese el exponente: ";
cin>>b;
c=(pow(a,b));
cout << a<<"^"<< b<<"= "<< c ;
break;
}
case 'r':{
cout <<"\nRADICACION\n\n";
cout << "Ingrese el radicando: ";
cin>>a;
cout << "Ingrese el indice: ";
cin>>b;
c=(pow(a,(1/b)));
cout <<"Raiz "<< b<<" de ("<< a<<")= "<< c;
break;
}
case 's':{
cout <<"\nSENO\n\n";
cout << "Ingrese el angulo en radianes: ";
cin>>a;
c=sin(a);
cout <<"SEN ("<< a<<")= "<< c ;
break;
}
case 'c':{
cout <<"\nCOSENO\n\n";
cout << "Ingrese el angulo en radianes: ";
cin>>a;
c=cos(a);
cout <<"COS ("<< a<<")= "<< c ;
break;}

case 't': {court
<<"\nTANGENTE\n\n";
<< "Ingrese el angulo en radianes: ";
court cin>> a;
c = tan (a);
court <<"TAN ("<< a<<")= "<< c ;
break;}


} return 0;}

0 comments:

Post a Comment