hey 
you declared the convert function to take in a float and then didnt pass a 
float to it in you main code. i assume you ment to pass dollar to convert. And 
then you said you would return a float from convert and instead you return 
(main) . you should have returned the float that you calculated in convert. so 
you would replace 1 with d in the equation p = 1*46 and then return p. 


peso = convert(dollar);

float convert(float d)

{ 

      float  p ;

      p = d*46; //computation to convert dollar to peso

      return (p); // returns the value of p to main function

} 


To: [email protected]
From: [email protected]
Date: Tue, 17 Aug 2010 06:54:32 +0000
Subject: [c-prog] C++, Can anyone help me what's wrong of my program...tnx


















 



  


    
      
      
      // 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();

    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

      return (main); // returns the value of p to main function

} 





    
     

    
    






                                          

[Non-text portions of this message have been removed]



------------------------------------

To unsubscribe, send a blank message to 
<mailto:[email protected]>.Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/c-prog/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/c-prog/join
    (Yahoo! ID required)

<*> To change settings via email:
    [email protected] 
    [email protected]

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

Reply via email to