Título: necesito ayuda urgente porfavor Publicado por: manguito_sport en 14 Diciembre 2011, 10:53 am tengo este programilla que me mando el profe presentar mañana pero no soy capaz a hacer que me guarde los datos (toy muy verde en esto de programacion):
#include<stdio.h> #include<string.h> #include<math.h> #include<conio.h> int anterior; void ordena (void); void crear (void); void mostrar (void); void buscar (void); void borrar (void); struct rallye{ char Nombre_del_Rallye[20]; char Fecha_del_Rallye[20]; char Modelo_coche[20]; char Grupo_y_clase[20]; char Posicion_final[20]; float T; float P; float final; }; struct rallye rallye[200]; int menu (void){ printf ("\t\t***MENU****\n"); printf ("\t1. Introducir datos de Rallye.\n"); printf ("\t2. Borrar un Rallye.\n"); printf ("\t3. Buscar un Rallye.\n"); printf ("\t4. Ordenar.\n"); printf ("\t5. Mostrar lista de Rallyes.\n"); printf ("\t6. Modificar datos.\n"); printf ("\t7. SALIR\n\n"); printf ("Elija una opciOn: "); } int main (){ int op; int F=0; op==menu(); scanf ("%d", &op); printf ("\n\n"); while (op !=7){ if (op==1){ printf ("\Introducir datos de Rallye.\n"); crear (); op==menu(); scanf ("%d", &op); } else{ if(op==2){ printf ("\nBorras datos de Rallye.\n"); borrar (); op==menu(); scanf ("%d", &op); } else{ if(op==3){ buscar (); op==menu(); scanf ("%d", &op); } else { if(op==4){ printf ("\nOrdenar\n"); op==menu(); scanf ("%d", &op); } else{ if(op==5){ printf ("\nMostrar lista de Rallyes\n"); mostrar(); op==menu(); scanf ("%d", &op); } } } } } } } void crear(){ int F=0; int terminar; anterior=0; terminar=0; for (F=anterior; F<200&&terminar!=1; F++){ printf ("Introducir Nombre de Rallye:\t"); fflush (stdin); gets (rallye[F].Nombre_del_Rallye); printf ("Introducir fecha del Rallye:\t"); fflush (stdin); gets (rallye[F].Fecha_del_Rallye); printf ("Introducir Modelo de coche: \t"); scanf ("%s", rallye[F].Modelo_coche); printf ("Introducir Grupo y Case:\t"); fflush (stdin); gets (rallye[F].Grupo_y_clase); printf ("Introducir Posicion final:\t"); fflush (stdin); gets (rallye[F].Posicion_final); printf ("¿Ha terminado de introducir datos?\n1=Si\t 2=No"); scanf ("%d", &terminar); anterior==F; printf ("\n\n"); } } void mostrar (){ int F; F=0; anterior=0; printf ("\n\ nNombre del Rallye Fecha Coche Grupo-Clase Posicion \n\n"); for (F=anterior; F<200; F++){ rallye[F].final= (40*rallye[F].T)/100+(60*rallye[F].P)/100; printf ("%s ", rallye[F].Nombre_del_Rallye); printf ("%s ", rallye[F].Fecha_del_Rallye); printf ("%s ", rallye[F].Modelo_coche); printf ("%s ", rallye[F].Grupo_y_clase); printf ("%s ", rallye[F].Posicion_final); anterior==F; } printf ("\n\n"); } void buscar (){ int F; char busco[30]; printf ("\n\nBuscar por nombre del Rallye: "); fflush (stdin); gets (busco); for (F=0; F<200; F++){ if (strcmp (busco, rallye[F].Nombre_del_Rallye)==0){ printf ("\n%s", rallye[F].Fecha_del_Rallye); printf ("\n%s", rallye[F].Modelo_coche); printf ("\n%s", rallye[F].Posicion_final); } } if (strcmp (busco, rallye[F].Nombre_del_Rallye)!=0){ printf ("\nNo se han encontrado coincidencias\n"); } } void borrar (){ int F; char busco[30]; int i; int k; printf ("\n\nBuscar por Nombre del Rallye: "); fflush (stdin); gets (busco); for (F=0; F<200; F++){ if (strcmp (busco, rallye[F].Nombre_del_Rallye)==0){ printf ("\n%s", rallye[F].Nombre_del_Rallye); printf ("\n%s", rallye[F].Fecha_del_Rallye); printf ("\n%s", rallye[F].Modelo_coche); printf ("\n¿Desea Borrar algun Rallye?\t1=SI\t2=NO\t"); scanf ("%d", &k); if (k=1){ for (i=F; i<200; i++){ rallye=rallye[i+1]; anterior--; } } else{ } } } if (strcmp (busco, rallye[F].Nombre_del_Rallye)!=0){ printf ("\nNo se han encontrado coincidencias\n\n"); } void modificar (); } Título: Re: necesito ayuda urgente porfavor Publicado por: Eternal Idol en 14 Diciembre 2011, 11:33 am No se hacen tareas.
|