as given, 2 of your function calls are commented out.
Are you not seeing the print statement from read side?
What OS? You may need to flush the output, try adding an endl to it:
cout << "Please enter the length of a side of your square room: " << endl;
also readside is going to bug you up in a bit. it will trip you because of the local s vs the global one. As a rule of thumb, having 2 things with the same name in the same scope is a recipe for human confusion. Don't do that. Also globals are poor, and should be avoided.
Do you know pass by reference yet?
for large code blocks use <> code tags (side of this editor).
Putting all that together, lets give this a try:
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
|
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
int ReadSize(int s);
int CalcArea(int a);
int Perimeter(int p);
int Estimate(int a, int p);
//s removed here
int main(int argc, char** argv) {
int ms, ma, mp;
int s; //s added here
s = ReadSide(ms); //s gets the result of the function which you discarded before
cout << "s = " << s << endl;
return 0;
}
int ReadSide(int ls) //this is the local s
{
cout << "Please enter the length of a side of your square room: " << endl;
cin >> ls;
return ls;
}
|
you can flush without endl, I think its cout.flush() if you want it all on one line.
I don't do a lot of console text programming with I/O so forgive me if that isnt exactly right.