1. ## 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

Code:
```#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;

double radius(double x, double y, double w, double z);
double diameter(double x);
double circumference(double x);
double area(double x);
const char p = 3.1416;

int main()
{
double orgin1, orgin2, pt1, pt2, radius, diameter, circumference;

cout << setprecision(2) << fixed << showpoint;

cin >> orgin1 >> orgin2;
cout << "Please input a point on the circle" << endl;
cin >> pt1 >> pt2;
cout << "Your origin is: " << "(" << orgin1 << "," << orgin2 << ")" << endl;
cout << "Your point is: " << "(" << pt1 << "," << pt2 << ")" << endl;
<< radius(pt1, orgin1, pt2, orgin2) << endl;
cout << "The diameter of your circle is: " << diameter(radius) << endl;
cout << "The circumference of your circle is: "
<< circumference(diameter) << endl;
cout << "The area of your circle is: " << area(radius) << endl;

return 0;
}

double radius(double x, double y, double w, double z)
{

x = pow(x-y,2);
w = pow(w-z,2);
sum = x + w;

}
double diameter(double x)
{
double diameter;
diameter = 2 * x;

return diameter;
}
double circumference(double x)
{
double cicumference;
circumference = p * x;

return circumference;
}
double area(double x)
{
double area;
area = p * x;

return area;
}```

2. Code:
```double radius(double x, double y, double w, double z)
{
Generally, names must be unique in your program.

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.

3. Code:
```#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;

double radius(double x, double y, double w, double z);
double diameter(double x);
double circumference(double x);
double area(double x);
const char p = 3.1416;

int main()
{
double orgin1, orgin2, pt1, pt2, radius, diameter, circumference;

cout << setprecision(2) << fixed << showpoint;

cin >> orgin1 >> orgin2;
cout << "Please input a point on the circle" << endl;
cin >> pt1 >> pt2;
cout << "Your origin is: " << "(" << orgin1 << "," << orgin2 << ")" << endl;
cout << "Your point is: " << "(" << pt1 << "," << pt2 << ")" << endl;
<< radius(pt1, orgin1, pt2, orgin2) << endl;
cout << "The diameter of your circle is: " << diameter(radius) << endl;
cout << "The circumference of your circle is: "
<< circumference(diameter) << endl;
cout << "The area of your circle is: " << area(radius) << endl;

return 0;
}

double radius(double x, double y, double w, double z)
{

x = pow(x-y,2);
w = pow(w-z,2);
sum = x + w;

}
double diameter(double x)
{
double diameter;
diameter = 2 * x;

return diameter;
}
double circumference(double x)
{
double cicumference;
circumference = p * x;

return circumference;
}
double area(double x)
{
double area;
area = p * x;

return area;
}```

omg,there are so many errors here,

(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;

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:

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.

4. ## The Secret To Programming -

My standard general advice for beginners…

HERE’S THE BIG SECRET TO PROGRAMMING –

DON’T TRY TO WRITE THE WHOLE PROGRAM AT ONCE!

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.