Beginning Modularization Techniques

Ok so ive pretty much done all of the work but the program still has some syntax errors that i need a little bit of help on. The program needs to reflect the pseudocode as closely as possible. On line 41 the equation for the newAmount needs to have a reference to call the finalAmount function, but everytime I place the FutureValue variable into the equation I start getting errors. If anyone has any insight it would be much appreciated. Thank You.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Start
//     Declarations
//       num amount
//       num newAmount
//       num interestRate
//     output "Please enter the dollar amount.   "
//     input amount
//     output "Please enter the interest rate(e.g., nine percet should be entered as 9.0).   "
//     input interestRate
//     newAmount = FutureValue(amount,interestRate)
//     output "The new dollar amount is ", newAmount
// Stop
//
//
//
// num FutureValue(num initialAmount, num interestRate)
//     Declarations
//       num finalAmount
//     finalAmount = (1 + interestRate/100) * initialAmount
// return finalAmount

#include <cstdlib>
#include <iostream>
using namespace std;

double FutureValue ();

int main()
{
    double amount;
    double newAmount;
    double interestRate; 
    
    cout << "Please enter the dollar amount.   " << endl;
    cin >> amount;
    
    cout << "Please enter the interest rate (e.g. nine percent should be entered as 9.0).   " << endl;
    cin >> interestRate;
    
     newAmount = (amount / interestRate);
     
     cout << "The new dollar amount is " << newAmount << endl;
     
    system("PAUSE");
    return EXIT_SUCCESS;
    
}

double FutureValue(double initialAmount, double interestRate)
{
    double finalAmount; 
        
    finalAmount = (1 + interestRate/100) * initialAmount;
    return finalAmount;
    }
You have forward declared the function FutureValue as
 
double FutureValue ();

when it should be
 
double FutureValue (double, double);
ahhh I see that now. Thank you.
Topic archived. No new replies allowed.