ghey
Newcomer
- Joined
- Nov 6, 2010
- Sythe Gold
- 0
- Messages
- 24
The function void info uses variables from float question why is the values from these variables not shown in void info it appears as 0.[/php]
Code:
#include<iostream>
using namespace std;
void Greeting ();
float Question ();
void info (float, float, float);
float balance, total, i;
int main()
{
Greeting();
Question();
info(balance, total, i);
system("pause");
return 0;
}
void Greeting()
{
cout<< "Welcome to the Bank of Kwantlen!"<< endl << endl;
return;
}
float Question()
{
char answer;
float amount, rate, goal, newbalance, total, balance, i;
int num;
num = 5;
cout <<"Do you want to invest (i) with us or borrow (b) from us? ";
cin >> answer;
cout << endl;
cout << "Enter the amount to invest annually: ";
cin >> amount;
cout << "Enter the yearly percentage rate of return: ";
cin >> rate;
cout << "Enter the investment goal: ";
cin >> goal;
cout << endl;
cout << "Year Balance Balance\n";
cout << " (Jan. 1) (Dec. 31)\n";
total = 0;
i=1;
newbalance =0;
balance =0;
while (total < goal)
{
balance = total + amount;
total = balance *(1+(rate/100));
cout << i << " " << balance << " " << total << endl;
i++;
}
return balance;
return total;
return i;
}
void info (float balance, float total, float i)
{
cout << total;
cout << balance;
cout << i;
}













