• 05-01-2002
abbynormal87
Ok i'm doing a function for the radius of a circle..
power area (float
correct me if i'm wrong..

float area = 0;
float PI = 3.1415;

cout >> "Enter the radius:" >> endl;

cout >> " The area of the circle is :" >> area >> endl;
• 05-01-2002
blight2c
asking well articulated questions will get you a better responses around here. the above failing, at least _ask_ a question
• 05-01-2002
Unregistered
ok my question is do i have the formula right or not. ;0
• 05-01-2002
abbynormal87
ok the if statment is not working & I think i have the radius formula wrong..

#include <iostream>
#include <cctype>
#include <iomanip>
#include <string>
using namespace std;

//float power(float x, int y)

int main()

{
int choice = 0;
int start = 0;
int ending = 0;
int hours = 0;
int min = 0;
int sec = 0;

float area = 0;
double PI = 3.1415;

cout << "ITSE 2431" << endl;

cout << "Spring 2002 " << endl;

cout << "1. Calculate Average Velocity " << endl;
cout << "2. Calculate Area of a Circle " << endl;
cout << "3. Quit " << endl;

cout << "Make a selection (1-3): " << endl;

cin >> choice;

switch (choice)

do
{
case 1:
cout << "Calculate Average Velocity" << endl;
cout << "Starting Mile Marker: " << endl;
cin >> start;
cout << "Ending Mile Marker: " << endl;
cin >> ending;
cout << "Elapsed Time: " << endl;
cout << " Hours: " << endl;
cin >> hours;
cout << " Minutes: " << endl;
cin >> min;
cout << "Seconds: " << endl;
cin >> sec;

break;

case 2:

cout << "Calculate Area of a Cirlce" << endl;

cout << "The area of a circle with radius " << "is " << "units." << endl;

cout << "Enter the radius:"<< endl;

cout << " The area of the circle is :" << area << endl;

break;

default:
cout << "You entered a wrong number" << endl;

}while

if(choice = 3);
cout << "Quit" << endl;
system ("CLS");

cout << setw(50)<< "Program terminated by user "
<< endl;
break;

return 0;

}
• 05-01-2002
blight2c
you're talking to the one and only blight2c, and all you want to know is how to figure the area of a circle. ;) if i recall it's
a=pi r^2
• 05-01-2002
blight2c
sorry to give you a hard time buddy. :) i changed you switch(choice) around --you don't need the dowhile() in there. try emulating it and tell me what happens.

Code:

``` switch (choice) {         case 1:                 cout << "Calculate Average Velocity" << endl;                 cout << "Starting Mile Marker: " << endl;                 cin >> start;                 cout << "Ending Mile Marker: " << endl;                 cin >> ending;                 cout << "Elapsed Time: " << endl;                 cout << " Hours: " << endl;                 cin >> hours;                 cout << " Minutes: " << endl;                 cin >> min;                 cout << "Seconds: " << endl;                 cin >> sec;                 break;         case 2:                 cout << "Calculate Area of a Cirlce" << endl;                 cout << "The area of a circle with radius "                         << "is " << "units." << endl; }```

how old are you, if you don't mind me asking?
• 05-01-2002
abbynormal87
private
if u want to know that info
• 05-01-2002
Unregistered
Quote:

if (choice = 3);
cout << "Quit" << endl;
system ("CLS");
should be

Code:

```if (choice == 3); cout << "Quit" << endl; system ("CLS");```
• 05-02-2002
abbynormal87
thanks
thanks unregistered ... but now i have the problem where i was case 1 & 2 to keep going unless I press the option of 3.

Like a never ending loop till i press the option 3 to quit the program