Something wrong?

#include "stdafx.h"
#include <iostream>
#define pi 3.14


using namespace std;
int main ()
{

double circle;
int n,a;
n=1;
a=2
;{
loop:
cout<<"Robert's Circumference and Area of a Circle Calculator\n";
cout<<"Enter the Radius\n" ;
cin>>circle;
cout<<"The circumference of a circle is\n"<<circle<<(2 * circle * pi)<<endl ;
cout<<"The Area of the Circle is\n"<<circle<<(circle * circle * pi)<<endl;
}
system("pause")
;if (n=a) goto loop;

;return 0;
}


it has no errors just that the forumula for the circle is wrong since it gives me the wrong answer. All this sopose to do is you type in the radius press enter and it gives you circumference and area of the circle. Please help me. I googled the formula and i used them. Then I keep getting the wrong answer and changed the forumula over and over again.
Well it's probably just a formatting error...you should put a space after you cout out the value of "circle".
The circumference of a circle is pi * r2 not 2*circle*pi and by circle I assume you mean radius?

Its your calculations that are wrong.

Edit: Yea yea your right, I was thinking of the area
Last edited on
No his calculations are right - it's his formatting of the result that's needs clearing up.

(It's just bad that he used a variable called circle to represent a value called radius.)
Still gives me wrong answer .....
Can you give us few results that you get when you enter 1; 2,1 or etc?
drag421
It calculates the right answers - but it's your outputting of the answers that is badly formatted - can't you see that??
Last edited on
I'll repeat myself: PUT A SPACE BETWEEN CIRCLE AND THE AREA/CIRCUMFERENCE FORMULAS :)
Fire I did that still wrong answer
Guest
Can you explain a little bit more I'm kind of new to this.
Why are you printing circle THEN the formula after it?

change these lines:
1
2
cout<<"The circumference of a circle is\n"<<(2 * circle * pi)<<endl ;
cout<<"The Area of the Circle is\n"<<(circle * circle * pi)<<endl;

Thanks psault I got it
Topic archived. No new replies allowed.