Not sure how to use ReadData Function

We were asked to create a program that register user input into ReadData function and use the input to calculate present value, however,I am not sure what do I need to put in the body of the ReadData Function.

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
57
58
59
60
61
62
63
64
65
  #include <iostream>
using namespace std;

bool MoreData()
{
    char input;
    double amount;
    int term;
    double rate;
    cin >> input;
  if ((input == 'Y') || (input == 'y'));
        {
            cout << "Please enter the payment amount:";
            cin>> amount;
            cout << "Please enter the term:";
            cin >> term;
            cout << "Please enter the interest rate:";
            cin >> rate;
            return true;
            
  if ((input == 'N') || (input == 'n'));
        {return false;} 
    if ((input != 'N') || (input != 'n'));
        {
            cout << "Invalid response, please enter Y or N: ";
            cin >> input;
    }}
}
double Power(double rate,int term){
 double result;
    int i;
    result =1.0;
    if (term == 0);{return 1.0;}
    if (rate == 0);{return 0;}
    for (i=1;i<=term;i++);
    {
        result = result*rate;
    }
    result = 1.0/ result;
    return(result);
}
void ReadData(double& amount,int& term,double& rate){

double PresentValue(double, double, int);
double PresentValue(double amount, double rate, int term){
    double p; 
    p = amount/((1-Power(rate,term)/rate));
    return p;}

int main ()
{
double amount = 0;
int term = 0;
double rate = 0;
double p = 0;

cout << "Would you like to compute a present value (Y/N)? ";
MoreData();
ReadData(amount,term,rate);
rate = rate * .01;
Power(1+rate,term);
p = PresentValue(amount, rate, term);
cout << p;
return 0;
}
nix215 wrote:
I am not sure what do I need to put in the body of the ReadData Function.

What you have currently put in the body of the MoreData function.
Topic archived. No new replies allowed.