LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 01-04-2009, 11:57 PM   #1
jus71n742
Member
 
Registered: Apr 2008
Distribution: Ubuntu 8.04 64bit/ 32bit, FreeBSD 8
Posts: 185

Rep: Reputation: 30
Question invalid operands of types ‘<unresolved overloaded function type>’ and ‘double’ to


invalid operands of types ‘<unresolved overloaded function type>’ and ‘double’ to binary ‘operator*’

I have no idea what this is saying is wrong with my code....its just a compound interest program that I am writing continuing with getting used to c++ coding.

here is the whole program so far.

Code:
#include<iostream>
using namespace std;
#include<cmath>

int main()
{
double a;
double p;
double r;
double n;
double t;

cout<<"what are you solving for?(amount, principle, rate(decimal), time, number of compounds)(0 if missing)\n";         //prompt for variables//
cin>>a>>p>>r>>t>>n;
if (a==0){
a=p*(1+(r/n));exp(n*t);                         //formula to find the amount//
cout<<"your amount is $"<<a<<endl;
}
else if(p==0){
p=(a)/((1+r/n))*(exp*(n*t));                    //formula to find the principle amount//
cout<<"Your principle is $"<<p<<endl;
}
else if(r==0){
r=n*sqrt((a/p)-1);                              //finding the interest rate//
cout<<"Your interest rate is "<<r<<"%\n";
}
else if(n==0){
n=(log(a)-log(p))/(log(1+r));                   //find the number of compounds//
cout<<"your investment compunded "<<n<<" times.\n";
}
else{
t=((log(a))/(log(1+(r/n))))/n;                  //finds the missing time//
cout<<"it took "<<t<<" years.\n";
}
return 0;
}
 
Old 01-05-2009, 12:03 AM   #2
jtshaw
Senior Member
 
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Blog Entries: 1

Rep: Reputation: 65
Line 20.

Code:
p=(a)/((1+r/n))*(exp*(n*t));                    //formula to find the principle amount//
should be:
Code:
p=(a)/((1+r/n))*(exp(n*t));                    //formula to find the principle amount//
 
Old 01-05-2009, 12:27 AM   #3
jus71n742
Member
 
Registered: Apr 2008
Distribution: Ubuntu 8.04 64bit/ 32bit, FreeBSD 8
Posts: 185

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by jtshaw View Post
Line 20.

Code:
p=(a)/((1+r/n))*(exp*(n*t));                    //formula to find the principle amount//
should be:
Code:
p=(a)/((1+r/n))*(exp(n*t));                    //formula to find the principle amount//
thought it would be something tiny like that. Thanks for spotting that.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
why get compiler error: suffix or operands invalid for 'push' (or 'pop') maxreason Programming 1 08-10-2008 10:42 AM
Compilation Error:unresolved overloaded function type in C++; ravikumarv Programming 1 04-28-2008 08:40 AM
C++ overloaded operator 3 times faster than c function call ? cant work out why ? qwijibow Programming 6 01-07-2008 07:18 PM
Error: suffix or operands invalid for `push' in 64 machine arya Linux - General 1 04-19-2007 10:32 AM
gcc: invalid operands ajacques Linux - General 1 10-25-2004 07:31 AM


All times are GMT -5. The time now is 07:50 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration