4 Replies - 1103 Views - Last Post: 30 October 2006 - 03:16 PM Rate Topic: -----

#1 chrisbenoit06  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 24-October 06

Debug Help

Posted 28 October 2006 - 05:38 PM

Any one good at debugging?

#include <stdio.h>

#define PI is 3.14159

/* Function Prototypes */

double Area(double radius)
double Circum(double radius)

/* Main Program */

int main(void)
{
		double raduis;

		printf("Enter radius of circle> ");
		scanf("%f", radius);

		print("The area is %f\n", Area(radius));
		printf("The circumference is %f\n, Circumference(radius));
}



double Area(double radius)
{
		return (PI * radius * radius)
}




Is This A Good Question/Topic? 0
  • +

Replies To: Debug Help

#2 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 248
  • View blog
  • Posts: 13,506
  • Joined: 12-July 02

Re: Debug Help

Posted 28 October 2006 - 05:46 PM

Can you specify the problem you are encountering, along with any error messages? The first thing I see is that you have a function prototype for a function called Circum, but are attempting to call a function named Circumference - neither of which has been defined. The prototypes will also need to be terminated with a semi colon. You've decalred a variable named raduis, but are trying to use a variable named radius, which has not been declared. In your Area function, the return statement will need to be terminated with a semi colon. You main function is defined as returning an int, but no such return call exists at the end of the function. You have used the incorrect syntax for a define statement...it should appear as follows:
#define PI 3.14159


Those are a few items.

Quote

Any one good at debugging?

I've been moderately successful at it in the past.
Was This Post Helpful? 0
  • +
  • -

#3 chrisbenoit06  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 24-October 06

Re: Debug Help

Posted 30 October 2006 - 02:19 PM

Thanks for your aid...I'm new and am struggling with c++...I am however finding it interesting..thanks again
Was This Post Helpful? 0
  • +
  • -

#4 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 248
  • View blog
  • Posts: 13,506
  • Joined: 12-July 02

Re: Debug Help

Posted 30 October 2006 - 02:21 PM

Not a problem sir! Everyone begins at one time or another, and we all go through the same things. I'm sure that in no time at all you'll be an accomplished programmer. Feel free to ask any questions you have on the site - that's what we're here for.
Was This Post Helpful? 0
  • +
  • -

#5 ifoam  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 54
  • Joined: 26-October 06

Re: Debug Help

Posted 30 October 2006 - 03:16 PM

printf("The circumference is %f\n, Circumference(radius));

printf("The circumference is %f\n", Circumference(radius));

also forgetting that quote
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1