Need Extensive help

This is a discussion on Need Extensive help within the C++ Programming forums, part of the General Programming Boards category; Ok, I am sorry but this is a beginners program and I need serious help. First of all I am ...

Need Extensive help

Ok, I am sorry but this is a beginners program and I need serious help. First of all I am trying to use User-Defined function I. I am trying to find the radius, diameter, circumference, and area of a circle. I know my code is messed up and I need help, please. I am getting errors in my int main() where radius: this statement doesn’t take 4 arguments, circumference: this statement doesn’t take 1 argument, and diameter: this statement doesn’t take 1 argument. Also I would like to know how to get the symbol for pie on the keyboard and the initialize it “globally”. Please Help

Also I would like to know how to get the symbol for pie on the keyboard and the initialize it “globally”.

That doesn't make any sense, and you shouldn't use global variables anyway. Explain in great detail exactly what you want to accomplish.

Code:

const char p = 3.1416;

A char type can only store one character, and when you assign a number to a char type, it is assumed the number is the ascii code for a single character. Take a look at an ascii table in the back of your C++ book or online. Computers can only store numbers in memory, so a computer converts all characters to numeric codes. An ascii table lists commonly used characters and their numeric codes.

(1) name the function and variable differently,
that is dont have a function radius and a double radius at the same time, have it like double rad.(this was pointed out earlier).

(2)why not store value of p in a double instead of a char.
double p =3.146;

(3)check the spelling of origin1 ,one place it is spelled as origin1 and in the function call as orgin1.(the "i" is missing.)

(4) similar for origin2;

(5) diameter(radius) !!!!!!!!!!!!!!!! lmao,,,,radius has no value assigned to it .
which should the compiler prefer "radius is a function", or "radius is the value returned by radius function".. u would want the compiler to think case2,,,but PLEASE REMEMBER COMPILERS R NOT THAT SMART.

merely saying "radius(pt1, orgin1, pt2, orgin2)" doesnt automatically change the value of the radius variable to the number returned by the function.
u have to have an explicit assignment,which could be done like this:

double rad= radius(pt1, orgin1, pt2, orgin2)" ;
diameter(rad);

if u want automatic ,use global static variables or use pointers.
(u have to brush up on SCOPE,GLOBAL VARIABLES,NAMESPACES)

(6) similar for other functions.
(7) there is no key associated with pie ,so u cant really get the symbol of pie to show up on the screen and associating it with 3.14 takes some coding i think.

perhaps u have to use a bitmap or import a font file,something like that.

The Secret To Programming -

Start-out with a Hello World type program.
Add one or two lines of code.
Test-compile and test-run.
Debug as necessary.
Repeat ‘till done.

It’s waaaaay easier to debug a few lines of code than to debug the entire program! And, programming is much more fun if you're not trying to fix 20 problems at once!

Now, you can’t just write your program in line-number sequence this way. You have to figure-out which segments to work on next, so that your incomplete program will compile and run.

When you make a function, start-out with the function prototype, the function call, and an “empty” function. If the function is going to return a value, the empty function can simply return a constant ( i.e return 5; ) Sometimes it’s helpful to put some temporary cout statements in your program so that you can “see” what’s going-on ( i.e cout << “In Radius() function”; ).

As you gain experience, you can write bigger chunks of code between test-compiling and test-running. But, your programs will be longer, so you still won’t write the whole program before testing! You will also learn how to write temporary test-code to test your functions before the entire program is done.

AFAIK, there’s no way to display the pi symbol in standard C++. It’s not in the standard ASCII table. It's 277 in the extended ASCII table, so on some systems you can probably just display 277 as a char... I don't think this will work on a Windows system, but I’m sure there is a way to do it with the Windows library.