• Viernes 3 de Mayo de 2024, 03:59

Autor Tema:  vectores de temperaturas  (Leído 1319 veces)

elpis

  • Nuevo Miembro
  • *
  • Mensajes: 9
  • Nacionalidad: 00
    • Ver Perfil
vectores de temperaturas
« en: Domingo 10 de Julio de 2011, 22:41 »
0
Hola a todos!!
el problema es el siguiente

Crear un programa que permita ingresar 15 datos, la TEMPERATURA PROMEDIO y CIUDAD a la que pertenece. Desplegar el siguiente menú.

   Ingresar Datos al vector
   Consulta de temperatura por CIUDAD
   Mayor temperatura
   Menor temperatura
   Temperatura promedio
   Temperaturas más cercanas a la media
   Salir

En todos los casos desplegar la CIUDAD a la que pertenece la temperatura.


pero me he entreverado con tantas funciones, haber si me ayudan... como sigeo y idea para relizar cada funcion tiendo en cuenta que para toda cosulta de temperatura hay que nombrar de que ciudad estamos hablando

//codigo

#include<stdio.h>
#include<conio.h>
struct temperatura{
   float   temp_prom[10];
   char    ciudad[10];
};
void menu(void);
void ingresar(struct temperatura[]);
void consulta(struct temperatura[]);

//void mayor(struct temperatura[]);
//void menor(struct temperatura[]);
//void promedio(struct temperatura[]);
//void cercana (struct temperatura[]);
void menu(void){
   clrscr();
   printf("nnntt1 - Ingresar Datos al vector");
   printf("ntt2 - Consuta de temperatura por CUIDAD");
   printf("ntt3 - Mayor temperatura");
   printf("ntt4 - Menor temperatura");
   printf("ntt5 - Temperatura promedio");
   printf("ntt5 - Temperaturas mas cercanas a la medida");
   printf("nntt6 - Salir");
}
void ingresar(struct temperatura temp[]){
   int i;
   for(i=0;i<16;i++){
      clrscr();
      printf("nnnttIngrese TEMPERATURA PROMEDIO");
      scanf("%f",&temp.temp_prom);
      flushall();
      printf("nnnttIngrese CIUDAD");
      gets(temp.ciudad);
      flushall();
   }
}
void consulta(temperatura tem[15]) {
   clrscr();
   char auxi;
   printf("Ingrese Ciudad");
   scanf("%s",auxi);

   }
void main(){
   temperatura temp[15];
   clrscr();
   int op;
   menu();
   scanf("%i",&op);
   switch(op){
      case 1: ingresar(temp);
         break;
      case 2: consulta(temp);
         break;
   //   case 3: mayor(temp);
     //      break;
       //   case 4: menor(temp);
         ///      break;
      //case 5: promedio(temp);
        //   break;
//      case 6: cercana(temp);
  //         break;
   }

}