Hey everyone,
I'm new on the forums and I'm also quite new still too C++ programming I'm taking a course in it in college (to meet my requirements) Its not my major and I'm terrible at math to boot. I have an assignment where the professor wants us to make a program that calculates the radius area and circumference of a circle based on 4 points the user enters, (the center and two points on the circle) I can get the program to start but when I go to enter numbers the program crashes with the following error:

Run-time error check failure #3- the varriable rad is being used without being initialized.

But I don't believe I need to initialize any of those, heres the code:

``````#include <iostream>
#include <iomanip>
using namespace std;
// prototypes go here
double circumfrence(double, double);
double area(double, double);
int main()
{
int x1;
int x2;
int y1;
int y2;
double circum;
double ar;
double circumfrence1;
const double pi=3.141616;
cout << "This Program Finds The Area, Radius and Circumfrence of a circle!" << endl;
cout << "Please where the center of the circle is, please enter two numbers " << endl;
cin >>x1;
cin >>y1;
cout << "Please enter a point of the circle, please enter two numbers " << endl;
cin >> x2;
cin >> y2;
cout << "The Radius of the Circle is:" << rad << endl;
cout << "The Area of the Circle is:" << ar << endl;
cout << "The Circumfrence of the Circle is:" << circum << endl;
}
double radius(int p2,int p1, int c2, int c1)
{

}

{
double ar;
return ar;
}

{
double circum;
return circum;
}``````

I believe it has something to either do with my data types, return types or maybe just my equations. Although I am not to sure, any help on this would really be appreciated .

Edited by __avd: Added [code] tags. Encase your code in: [code] and [/code] tags.

2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by soapyillusion

Please use code-tags the next time...

``````double rad;
double circum;
double ar;
double circumfrence1;
const double pi=3.141616;
cout << "This Program Finds The Area, Radius and Circumfrence of a circle!" << endl;
cout << "Please where the center of the circle is, please enter two numbers " << endl;
cin >>x1;
cin >>y1;
cout << "Please enter a point of the circle, please enter two numbers " << endl;
cin >> x2;
cin >> y2;