Do while loop not showing final value

My assignment is to make an inline function that calculates stock value, it seems to work but when I exit the loop it doesn't show the final value from the accumulator, what is the issue?

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
#include <iostream>
using namespace std;
inline float calculateStockValue(float shares,float price)
{
    return shares*price;
}

int main ()
{
	char response;
	float total=0;
do
{
	float shares;
	float price;
cout<<"Number of shares of a stock: ";
cin>>shares;
cout<<"Price of the stock: ";
cin>>price;
total =  calculateStockValue(shares, price) + total;
cout << "Would you like to enter another stock ? [y/n] ";
cin >> response;
response=tolower(response);
	}
while(response=='y');
cout<<"Stock Portfolio Value is "<<total; 
return 0;
}
Topic archived. No new replies allowed.