output - error in outputting information c programming -



output - error in outputting information c programming -

this programme works how want there 1 bug. doesn't convert euro dollar, gives me

0.0 euro = 0.0 dollars;

can guys help me please?

#include <stdio.h> #include <stdlib.h> void dollar(float dollar); int main() { char what; int howmany; int i; float dollar2; float euro2; printf("enter how many times want convert\n"); scanf(" %d", &howmany); printf("enter u if want convert usd euro\n"); printf("enter e if want convert euro usd\n"); for(i=0; i<=howmany-1; i++) { scanf(" %c", &what); if(what == 'e') { printf(" come in how many euros want convert\n"); scanf(" %f", &euro2); euro(euro2); } if(what == 'u' ){ printf(" come in how many dollars want convert\n"); scanf(" %f", &dollar2); dollar(dollar2); } } homecoming 0; } void dollar(float dollar) { float euro = 0.94 * dollar; printf("%0.2f dollar = %0.2f euro\n", dollar, euro); return; } void euro(float euro) { float dollar = 1.37 * euro; printf("%0.2f euro = %0.2f dollar\n", euro, dollar); return; }

"in computer programming, function prototype or function interface declaration of function specifies function's name , type signature (arity, parameter types, , homecoming type), omits function body." https://en.wikipedia.org/wiki/function_prototype

bascially, since euro declared after main, when have phone call euro in main, has no thought function is. avoided declaring function above main, or using function prototype.

the construction of function prototype this

your_return_type function_name(arg_type,arg_type,arg_type....);

c output scanf

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -