Welcome to Dream.In.Code
Become a C++ Expert!

Join 137,397 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 2,103 people online right now. Registration is fast and FREE... Join Now!




Debug Help

 
Reply to this topicStart new topic

Debug Help

chrisbenoit06
28 Oct, 2006 - 04:38 PM
Post #1

New D.I.C Head
*

Joined: 24 Oct, 2006
Posts: 13


My Contributions
Any one good at debugging?

CODE

#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)
}


User is offlineProfile CardPM
+Quote Post

Amadeus
RE: Debug Help
28 Oct, 2006 - 04:46 PM
Post #2

g++ -o drink whiskey.cpp
Group Icon

Joined: 12 Jul, 2002
Posts: 12,230



Thanked: 40 times
Dream Kudos: 25
My Contributions
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:
CODE

#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.
User is offlineProfile CardPM
+Quote Post

chrisbenoit06
RE: Debug Help
30 Oct, 2006 - 01:19 PM
Post #3

New D.I.C Head
*

Joined: 24 Oct, 2006
Posts: 13


My Contributions
Thanks for your aid...I'm new and am struggling with c++...I am however finding it interesting..thanks again
User is offlineProfile CardPM
+Quote Post

Amadeus
RE: Debug Help
30 Oct, 2006 - 01:21 PM
Post #4

g++ -o drink whiskey.cpp
Group Icon

Joined: 12 Jul, 2002
Posts: 12,230



Thanked: 40 times
Dream Kudos: 25
My Contributions
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.
User is offlineProfile CardPM
+Quote Post

ifoam
RE: Debug Help
30 Oct, 2006 - 02:16 PM
Post #5

D.I.C Head
**

Joined: 26 Oct, 2006
Posts: 54



Thanked: 1 times
My Contributions
printf("The circumference is %f\n, Circumference(radius));

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

also forgetting that quote
User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 12/5/08 02:58AM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month