Line 2. I do not know what is in "circle.h", so it makes it hard to know what is wrong.
Line 3. Best not to use this. You should start learning what is in the "std::" name space and how to qualify those variables and functions.
Line 6. Looks like you are trying to define a function, but you are setting a variable. I do not think this will work. For now I changed it to:
constexpr double PI = 3.14159;
. If you are going to define PI yourself try to use as many decimal places as you can for a more accurate result.
Lines 9 and 10:
//Question 1a) Default constructor setting the radius to 1 if no value passed otherwise set radius to value passed.
This in not the default ctor it is an overloaded ctor and will only set the value of "radius" to the value of "r" unless the declaration in the class has a default value if no variable is passed.
This would be more inline with a default ctor:
radius = 0;
// <--- Any other variables that would need to be set.
And it would be a good idea to define a default dtor:
Line 16. The print function. Lines 18 and 19 make some sense, but after that this makes no sense:
|//Then write program to test Circle class by asking user for the radius of circle then create a circle object and report the circle’s area, diameter and circumference.|
The print function should only print and nothing more. Lines 21 - 24 should be a separate function. Then there is the point that you define "potato", which means what exactly, and then never use this variable.
Line 28. A function that is never used.
Line 34. Will work.
Line 42. Function works, but you never use the return value. Depending on what is in the class this function may not be written correctly.
Line 52. This function is about half right. Again you define "potato" and give it a value. Print it out, that is OK. And then return "perimeter". Where is "perimeter" defined and where does it get its value?
Line 62. Looks OK, but never used. Again depending on how you set up the class this may be wrong too.
Line 72. You create an object of "Circle", but with no default ctor it contains garbage for the variable value(s).
Line 73. Creates another object, but this time the overloaded ctor is used to initialize the variable "radius".
Line 74. calls the "getPerimeter()" function of the class, but you do not collect or use the return value of the function.
Line 76. Will work, but you will be printing a garbage value.
Line 79. Is a little better. At least the value of "radius" will not be garbage.
When I refer to a variable as containing garbage this means that since the variable was not given an initial value or otherwise initialized it contains whatever is in the memory location when space for that variable was set aside.
Hope that helps,