Jump to content
  • Advertisement
Sign in to follow this  
clickonpreet

having problem with my program

This topic is 2442 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
You have a local variable called calculateInterest so when you try to call the function named calculateInterest you are actually referring to the local variable, and that can obviously not work. You will have to use different names for the variable and the function. You also have to declare the function calculateInterest before main.

Share this post


Link to post
Share on other sites
You can use tags when posting code. It is also usual to post a description of the problem. Here, I imagine Wooh is correct the code does not compile. In this case, you should post the compiler errors. If it is a runtime logic error, you should post the expected vs actual behaviour.

Otherwise we may have to actually compile and run the code to see the problem, which puts a barrier in our way to helping you.

Share this post


Link to post
Share on other sites
In order to declare the signature of a function, you must do the following:

returnType funcName(arguments);

/*For Example - add this before the main method*/
double calculateInterest(double money, double interestRate, int years);


The way you did looked like you tried declaring it as a variable, just as Wooh said!

Share this post


Link to post
Share on other sites
Thanks alot all of you Wooh, rip-off, and kuramayoko10.
program is working now.

but still not showing the result, i think the problem is in the formula that i used...
Function was for compound interest
:mellow:

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!