07/01/13 20:53
lorenzoscarrone
#include <stdio.h> #include <math.h> //K-->F = ( K - 273.15)* 1.8000 //C-->K = (°C - 273.15) void celsius_K(float temp) { temp=(temp-273.15); } void farenheit_K(float temp) { temp=(temp/1.8000)+273.15; } int main() { int Ti,To; float t; printf("Convertitore di Temperature:\n\n"); printf("Temperatura input:\n"); printf("- 1 = Celsius (°C)\n"); printf("- 2 = Fareneit(°F)\n"); printf("- 3 = Kelvin ( K)\n"); scanf("%d", Ti); printf("Valore temperatura:"); scanf("%f", t); printf("\n\n"); printf("Temperatura output:\n"); printf("- 1 = Celsius (°C)\n"); printf("- 2 = Farenheit(°F)\n"); printf("- 3 = Kelvin ( K)\n"); scanf("%d", To); switch(Ti) { case 1:celsius_K(t); case 2:farenheit_K(t); case 3:t; } switch(To) { case 1:t=t+273.15; case 2:t=(t-273.15)*1.8000; case 3:t; } printf("Il valore della Temperatura è: %f \n",t); return 0; }
ecco l'output del compilatore:
gcc file.cc -o file file.cc: In function ‘int main()’: file.cc:26:15: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘int’ [-Wformat] file.cc:28:14: warning: format ‘%f’ expects argument of type ‘float*’, but argument 2 has type ‘double’ [-Wformat] file.cc:34:15: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘int’ [-Wformat]
aaa