#include <iostream>
usingnamespace std;
int main() {
double x, y;
double Total(double, double);
void readTotal(double);
cout << "Enter value of x: ";
cin >> x;
cout << "Enter value of y: ";
cin >> y;
Total(x, y);
readTotal(TotalofValues);
system("pause");
return 0;
}
double Total(double x, double y) {
double TotalofValues = 0;
TotalofValues = x + y;
}
void readTotal(TotalofValues) {
cout << "Your total is: " << TotalofValues << endl;
}
This is just an example I wrote up in 5 minutes, but how would I reference TotalofValues back to my main? could I use Total as a variable (even though it is used as a function) and that would reference back to the int main() function? I'm just unsure on how to get it from one function back to main and then send it to another function.. With the program I got now, I can't do a function within a function because it would not meet the criteria.