 Hi all,

I would like to ask you all for some help.
I need to write a program that allows me to have a circle radius as input and then print out the diameter, circumference and area of that circle.
Easy task but i have to put the calculations in the output statement. can you tell me where i went wrong please?
Here is what i have got so far.

``````#include <iostream>

using std::cout;
using std::cin;
using std::endl;

int main()
{
const double PI = 3.14159;

double diameter;
double circumference;
double area;

cout << "The diameter is " <<double diameter = 2 * radius << endl; // have to write calculations in output statement
cout << "The circumference is " << double circumference = 2 * pi * radius << endl;
cout << "The area is " << double area = pi * radius * radius << endl;

return 0;

}``````

Delete lines 16, 17 and 18.

Delete everything to to the right = signs in the equations in lines 20, 21, 22 and put the = sign in the string identifying the operation that is being done.

cout << "The diameter is = " << 2 * radius …

## All 2 Replies

Delete lines 16, 17 and 18.

Delete everything to to the right = signs in the equations in lines 20, 21, 22 and put the = sign in the string identifying the operation that is being done.

cout << "The diameter is = " << 2 * radius << endl; thank you very much

the working sample is

``````#include <iostream>

using std::cin;
using std::cout;
using std::endl;

int main()

{
const double pi = 3.14159;