input first, then output..:( [message #1122776] |
Tue, 01 October 2013 23:11 |
Alessandro Raco Messages: 3 Registered: October 2013 |
Junior Member |
|
|
hi this is my code
#include <stdio.h>
#include <stdlib.h>
int main (void)
{
int km, litri, km_totali, litri_totali, contatore, immissione;
float consumo, consumo_medio;
km=0;
litri=0;
km_totali=0;
litri_totali=0;
consumo=0;
consumo_medio=0;
contatore=1;
immissione=1;
while( immissione == 1 )
{
printf("\ninserimento dati %d\n", contatore);
printf("\ninserisci km effettuati: ");
scanf("%d", &km);
printf("inserisci litri consumati: ");
scanf("%d", &litri);
consumo= km / litri;
printf("\nconsumo medio e: %.2f", consumo);
km_totali= km + km_totali;
litri_totali= litri + litri_totali;
consumo_medio= km_totali / litri_totali;
contatore++;
printf("\nProcedere con una nuova immissione?(1/0)");
scanf("%d", &immissione);
}
printf("\nfine inserimento dati carburante");
printf("\n\nil consumo medio totale e %.2f", consumo_medio);
return 0;
}
the output gives me a blank page, a cursor, no "printf" out, but it takes the variables, anyway.
if i type in order "24 (enter) 3 (enter)0"
here it comes the printf out
it works with ALL of my code, all! so i'm quite sure it's just a IDE setting problem.
where am i wrong?please!
|
|
|
|
Powered by
FUDForum. Page generated in 0.07786 seconds