Programación en c++ ej.
Enviado por Mariana Lopez Bravo • 16 de Noviembre de 2015 • Tutorial • 404 Palabras (2 Páginas) • 117 Visitas
/* INSTITUTO POLITECNICO NACIONAL
ESCUELA SUPERIOR DE INGENIERIA MECANICA Y ELECTRICA
PARCIAL 1
FECHA: 11/09/2015 HORA: 10:00 am
EJERCICIO # C
DESARROLLO: Diseña un programa que calcule las posiciones de un proyectil tira paravolico
x=Vicos(a)t
y=Visin(a)t-1/2t(g*g)
se declara dos arreglos unidimencionales que almacenaran todos los datos de
las posiciones desde un tiempo 0 hasta que el proyectil toque el piso;con incremento
en tiempo de 0.5 segundos.
EQUIPO: # 7 :
INTEGRANTES: LÓPEZ BRAVO MARIANA
BADILLO LÓPEZ JOSÉ RUBÉN
*/
#include <cstdlib>
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <conio.h>
#include <stdlib.h>
#define pi 3.1416
#define g 9.81
#define N 50
void leer (float &Vi,float &a,float &R);
float funX(float Vi,float a,float t);
float funY(float Vi,float a,float t);
using namespace std;
int main()
{
x[N], y[N], inc=0.5;
t=0,Vi,a,R;
int i=0, j=0;
leer (Vi, a, R);
while(y[i]>0 && i<50)
{
x[i]=funXVi*cos(a)*t;
y[i]=Vi*sin(a)*t-(0.5*g*(pow(t,2)));
i++;
}
printf("_______________");
cout<<"\t Tiempo\t X\t Y\n";
while(j<i)
{
printf("_______________________");
cout<<t<<"\t"<<x[j]<<"\t"<<y[j]<<endl;
printf("______________________________________\n");
t=t+Inc;
j++;
}
}
...