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;}

Tuesday, March 31, 2009

Pinky Free Phone Clip

Solution Lab 2 point 2

date point to many it seemed long, the truth there are many ways to fix and short ... ;)

This is one I propose, if they improve or do better porfa comment.

In general the algorithm checks if the day is right and ultimodiames stored in the variable 1 if the last day of the month and 0 if not.

Well I think that this solution is the maximum amount to copy two pages of a leaf type test ... or not?


# include using namespace std;

int main () {int
year, month, day, ultimodiames = 0;
<<"\nIngrese el dia";
court cin>> day;
<<"\nIngrese el mes";
court cin>> month;
<<"\nIngrese el ano";
court cin> > year;
if (year <=0 || mes> 12 <=0 || dia<=0 || dia>
court if (he == 31) <<"\nFecha ultimodiames = 1;
} else if ((mes == 4 ultimodiames = 1;}


else wrong court <<"\nEl año es bisiesto";

"<<"\nFecha correcta";
if (month == 12 & & day == 31) {year = year +1
;
month = 1;
day = 1; <=30){
<<"\nFecha correcta";
} else if (ultimodiames == 1) {month = month +1
;
day = 1;}
<=29 && ano%4==0){
<<"\nFecha correcta";
else day = day +1;

court return 0;}
<=28){
<<"\nFecha correcta";

Monday, March 30, 2009

Messages For Newborn Baby

These are also interesting ...

This is a set the simple exercise of it, who can now solve:

Write a program that reads a date in DD-MM-YYYY and calculate the number of days since January 1 of that year
<<"\nFecha Print the oldest, youngest, the sum and the arithmetic average of ten numbers from the keyboard accepted
Calculate the equivalent time in hours minutes and seconds to a number of seconds to read. The result should be printed in a format like this:
7322 seconds equals: 2 hours, 2 minutes and 2 seconds.

Estimate the number and value with a given accuracy, such accuracy being an input This number is given by the following series:
e = 1 + 1 / 1! + 1 / 2! + 1 / 3! +1 / 4! + ... ..

Given a month of the year, the number of days and the day of the week begins, following a program that displays on screen representation of the calendar for that month



Source: http://foro.elhacker.net / ejercicios/ejercicios_c-t35110.0.html
<<"\nMañana es: "<< ano <<"/"<< mes <<"/"<< dia ;