All pastes #621052 Raw Edit

Genom

public c v1 · immutable
·published 2007-07-15 22:20 UTC
rendered paste body
#include <stdio.h>void cekej(void){     int znak;     printf("Stisknete ENTER pro pokracovani...");     znak = getchar();     znak = getchar();}float vypocti_fahr(void){      float fahr, celsius;      printf("\nZadejte hodnotu teploty: ");      scanf("%f", &fahr);      celsius = (5.0/9.0)*(fahr-32.0);      return celsius;}float vypocti_cels(void){      float celsius, fahr;      printf("\nZadejte hodnotu teploty: ");      scanf("%f", &celsius);      fahr = ((celsius)/(5.0/9.0)+32.0);      return fahr;}int main(void){      int znak;      int i;      float vysledek = 0;             printf("\nTento program slouzi pro konvertaci teplot ze stupnu Fahrenheita na\nstupne Celsia a opacne.\n\n");            do      {                      printf("\n          Vyberte moznost:\n");                      printf("__________________________________________\n\n");                      printf("*** 1 - Prevod Fahrenheit - Celsius.   ***\n");                      printf("*** 2 - Prevod Celsius - Fahrenheit.   ***\n");                      printf("*** 3 - Konec programu.                ***\n");                      printf("__________________________________________\n\n");                                            scanf("%s", &i);                      switch(i)                      {                               case '1' :                                    printf("\nZvolili jste prevod Fahrenheit-Celsius\n");                                    vysledek = vypocti_fahr();                                    printf("Vysledek je: %.3f\n", vysledek);                                    printf("******************************\n\n");                                    cekej();                                    break;                                                                   case '2' :                                    printf("\nZvolili jste prevod Celsius-Fahrenheit\n");                                    vysledek = vypocti_cels();                                    printf("Vysledek je: %.3f\n", vysledek);                                    printf("*****************************\n\n");                                    cekej();                                    break;                                                                   case '3' :                                    printf("\nZvolili jste konec programu.\n");                                    break;                                                                                          default :                                      printf("\nChybna volba!\n");                                      break;                      }      }while(i != '3');       return 0;   }