for lines 14, 15 and 16 the error is that I have undeclared identifiers for a, b and c.
Does anyone know how to fix this?
thanks for your help.
#include <cmath>
#include <iostream>
#include <string>
using namespace std;
bool die(const string & msg);
bool getDouble(double a, const string & b) ;
double squarePerimeter(double a);
double squareArea(double a);
int main(){
cout << getDouble(a, "Enter length of side");
cout << squarePerimeter(b) ;
cout << squareArea(c) ;
return 0;
}
bool die(const string & msg){
cout << msg << endl;
exit(EXIT_FAILURE);
}
bool getDouble(double & a, const string & b){
cout << b;
if(cin>>a)
return true;
else
return false;
}
double squarePerimeter(double & a){
double b;
b = 4*a;
if (a<0)
bool die("side is negative");
else
cout << "The perimeter of the square is " << b << endl;
return b;
}
double squareArea(double & a){
double b;
b = a*a;
if (a<0)
bool die ("side is negative");
else
cout << "The perimeter of the square is " << b << endl;
return b;
}