--- In [email protected], Rick <mowgl...@...> wrote:
>
> Hi,
> 
> You should try compiling this. The compiler should give you errors. 
> But, I'll show below a few areas that need correcting.
> 
> ~Rick
> 
> >// Function to convert dollars to pesos using function. 1$ = 46.00
> >#include <stdio.h>
> >#include <conio.h>
> >#include <stdlib.h>
> >
> >//declaration
> >void head( );
> >float convert (float);
> >
> >main() //main
> >{
> >     float dollar, peso;
> >     head();
> >     printf ("\n\tPlease enter the dollar: $");    scanf ("%.2f",&dollar);
> >     peso = convert();
> 
> // You need to pass the dollar amount here. The convert() function 
> requires an argument; peso = convert(dollar);l
> 
> >     printf("\n\n\t\t$%.2f is equal to PH%.2f pesos.", dollar, peso);
> >     getch();
> >}
> >
> >
> >void head ()
> >{
> >   printf ("\n\t\t<<Function to convert dollars to pesos using 
> > function.>>\n");
> >}
> >  float convert(float d)
> >{
> >       float  p;
> >       p = 1*46; //computation to convert dollar to peso
> 
> // Here, you are simply setting p to 46. You want to use the passed 
> argument; p = d * 46.00;
> 
> >       return (main); // returns the value of p to main function
> 
> // Here you need to return the computed value, p. I don't know where 
> you get "main"; return (p);
> 
> >}
>

during function calling you have to pass doller variable as parameter.

Reply via email to