lunes, 23 de marzo de 2015

Trabajo de clase 23 marzo 2015 Sarahi Molina Nuñez

Problema 8

inicio
real e=12
real d=10
write "Edad         Regalo"
while (d<=1000)
{   write e
write d
d=2*d
e=e+1
}
fin

#include <conio.h>
#include <iostream.h>


main()
{
int e=12, d=10;

cout<<"Edad         Regalo"<<endl;
while (d<=1000)
{   cout<<e<<"\t""\t";
cout<<d<<endl;
d=2*d;
e=e+1;


}

  getch();
}


Problema 9

inicio
real x, y;
write "valor x     valor y"
for (x=2.0 to 10.0 step  x=x+0.5)
{
y=3x^5-2x^3+x
}
write x""     ""y
fin




#include <iomanip.h>
#include <iostream.h>
#include <math.h>
#include <conio.h>


main()
{

double x, y;
cout<<"valor x     valor y"<<endl;
cout<<setiosflags(ios::fixed);
cout<<setiosflags(ios::showpoint);
cout<<setprecision(5);
for(x=2.0; x<=10.0; x=x+0.5)
{
y=3*pow(x,5)-2*pow(x,3)+x;
cout<<setw(7)<<x<<"        ";
cout<<setw(14)<<y<<endl;
}

getch();
}

inicio
real x, y;
write "valor x     valor y"
for (x=1.0 to 1.00 step x=x+0.1)
{
y=1+x+(x^2)/2+(x^3)/6+(x^4)/24
}
write x""     ""y
fin

#include <iomanip.h>
#include <iostream.h>
#include <math.h>
#include <conio.h>


main()
{

double x, y;
cout<<"valor x     valor y"<<endl;
cout<<setiosflags(ios::fixed);
cout<<setiosflags(ios::showpoint);
cout<<setprecision(5);
for(x=1.0; x<=1.0; x=x+0.1)
{
y=1+x+pow(x,2)/2+pow(x,3)/6+pow(x,4)/24;
cout<<setw(7)<<x<<"        ";
cout<<setw(14)<<y<<endl;
}

getch();
}

inicio
real t, y;
write "valor x     valor y"
for (t=4.0 to 10 step  t=t+0.2)
{

y=2e^0.8t

}
write t""     ""y
fin


#include <iomanip.h>
#include <iostream.h>
#include <math.h>
#include <conio.h>


main()
{

double t, y;
cout<<"valor t     valor y"<<endl;
cout<<setiosflags(ios::fixed);
cout<<setiosflags(ios::showpoint);
cout<<setprecision(5);
for(t=4.0; t<=10; t=t+0.2)
{
y=2*exp(0.8*t);
cout<<setw(7)<<t<<"        ";
cout<<setw(14)<<y<<endl;
}

getch();
}



No hay comentarios:

Publicar un comentario