// I am trying to calculate the initial cost, current cost, and profit in this program. But somehow the calc() function wasn't working.
#include<iostream>
using namespace std;
int main()
{
int shares;
cout<<"Enter the number of shares: ";
cin>>shares;
cout<<shares<<endl;
int buy;
cout<<"Enter the Price you bought in: $";
cin>>buy;
cout<<buy<<endl;
int current;
cout<<"Enter the current price: ";
cin>>current;
cout<<current<<endl;
void calc(float shares, float current, float buy, float &total, float ¤tval, float &profit);
return 0;
}
void calc(float shares, float current, float buy, float &total, float ¤tval, float &profit)
{
total=shares*buy;
currentval=shares*current;
profit=currentval-total;
cout<<"The total is $"<<total<<endl;
cout<<"The current value is $"<<currentval<<endl;
cout<<"The profit is $"<<profit<<endl;
}