This is a discussion on Idea for final project within the General Discussions forums, part of the Community Boards category; Originally Posted by std10093 About the char* you said, take a look at the last post here ..Read the fgets ...
Which means that these functions do not see the definition i would say...If you want to solve it post the code of it![]()
is it really that hard just to scroll through my code and see what im talking about?is the only place i use my pre defined PI, but when i add volumes i will use it more. again, this isn't necessarily a problem though as my code works fine without using the M_PI commandCode:case 5: { printf("\nArea Of A Circle\n"); printf("\nEnter the radius: "); scanf("%lf", &rad1); while(rad1 <= 0) { printf("ERROR!! Distance must be a positive number\n\n"); printf("Enter the radius: "); scanf("%lf", &rad1); } area = (rad1 * rad1) * PI; printf("The area of a circle with a radius of %.4f is %.4f\n\n", rad1, area); break; } case 6: { printf("\nArea Of An Ellipse"); printf("\nEnter radius-1: "); scanf("%lf", &rad1); while(rad1 <= 0) { printf("ERROR!! Distance must be a positive number\n\n"); printf("Enter radius-1: "); scanf("%lf", &rad1); } printf("\nEnter radius-2: "); scanf("%lf", &rad2); while(rad2 <= 0) { printf("ERROR!! Distance must be a positive number\n\n"); printf("Enter radius-2: "); scanf("%lf", &rad2); } area = (rad1 * rad2) * PI; printf("The area of an ellipse with a radius-1 of %.4f and a radius-2 of %.4f is %.4f", rad1, rad2, area); break; }
Last edited by friedsandwich; 11-15-2012 at 02:14 PM.
I did scroll down your code![]()
M_PI is not a command.It is defined inside the math library.
If you want to use it you have to replace PI with M_PI
What compiler/OS are you using?
Perhaps try adding this line directly above "#include <math.h>"
Code:#define _USE_MATH_DEFINES
I am using Pelles C, I use this because this is the one we use at school.
Maybe on top of the arithmetic your program offers you could add to the functionality with a memory function or 'cancel entry' function in case the user is say adding lots of numbers and makes a mistake with one of the values - you can remove the last one entered
Thought for the day:FLTK:The most fun you can have with your clothes on.You got big stones calling out GCC! (anduril462)
"If I had thought of it and had some marketing sense every computer and just about any gadget would have had a little 'C++ Inside' sticker on it'"