/* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include int main() { float t; float g; float vi; float vf; float p; float d; float s; printf (" *****************************************************\n"); printf (" :: Programa que calcula lo que EdR no sabe hacer ::\n "); printf ("*****************************************************\n"); principio: printf ("\nSelecciona lo que deseas calcular:\n [1] Velocidad Final\n [2] Velocidad Inicial\n [3] Tiempo\n [4] Gravedad\n [5] Distancia\n [6] Salir \n"); fflush( stdout ); scanf( "%f", &s ); if ( s==1 ) { printf( "Introduce tiempo: " ); scanf( "%f", &t ); printf( "Introduce gravedad: " ); scanf( "%f", &g ); printf( "Introduce velocidad inicial: " ); scanf( "%f", &vi ); vf = vi + (g * t); printf( "Velocidad final = %f ", vf ); printf( "\n" ); printf( "\n Deseas:\n [1] Calcular Otro\n [2] Salir\n" ); fflush( stdout ); scanf( "%f", &p ); if ( p==1 ) { printf ("_____________________________________________________"); printf (" \n"); goto principio; } else { return 0; } } else if ( s==2 ) { printf( "Introduce tiempo: " ); scanf( "%f", &t ); printf( "Introduce gravedad: " ); scanf( "%f", &g ); printf( "Introduce velocidad final: " ); scanf( "%f", &vf ); vi = (g * t) - vf; printf( "Velocidad inicial = %f ", vi ); printf( "\n" ); printf( "\n Deseas:\n [1] Calcular Otro\n [2] Salir\n" ); fflush( stdout ); scanf( "%f", &p ); if ( p==1 ) { printf ("_____________________________________________________"); printf (" \n"); goto principio; } else { return 0; } } else if ( s==3 ) { printf( "Introduce velocidad final: " ); scanf( "%f", &vf ); printf( "Introduce velocidad inicial: " ); scanf( "%f", &vi ); printf( "Introduce gravedad: " ); scanf( "%f", &g ); t = (vf-vi) / g; printf( "Tiempo = %f ", t ); printf( "\n" ); printf( "\n Deseas:\n [1] Calcular Otro\n [2] Salir\n" ); fflush( stdout ); scanf( "%f", &p ); if ( p==1 ) { printf ("\n_____________________________________________________"); printf (" \n"); goto principio; } else { return 0; } } else if ( s==4 ) { printf( "Introduce velocidad final: " ); scanf( "%f", &vf ); printf( "Introduce velocidad inicial: " ); scanf( "%f", &vi ); printf( "Introduce tiempo: " ); scanf( "%f", &t ); g = (vf-vi) / t; printf( "Gravedad = %f ", g ); printf( "\n" ); printf( "\n Deseas:\n [1] Calcular Otro\n [2] Salir\n" ); fflush( stdout ); scanf( "%f", &p ); if ( p==1 ) { printf ("\n_____________________________________________________"); printf (" \n"); goto principio; } else { return 0; } } else if ( s==5 ) { printf( "Introduce velocidad inicial: " ); scanf( "%f", &vi ); printf( "Introduce tiempo: " ); scanf( "%f", &t ); printf( "Introduce gravedad: " ); scanf( "%f", &g ); d = (vi*t) + (0.5 * g * t * t); printf( "Distancia = %f ", d ); printf( "\n" ); printf( "\n Deseas:\n [1] Calcular Otro\n [2] Salir\n" ); fflush( stdout ); scanf( "%f", &p ); if ( p==1 ) { printf ("\n_____________________________________________________"); printf (" \n"); goto principio; } else { return 0; } } else if ( s==6 ) { return 0; } }