-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconstant.cpp
More file actions
50 lines (44 loc) · 1.25 KB
/
constant.cpp
File metadata and controls
50 lines (44 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/******************
James Bertel
CS111
Lab 2-1: constant.cpp
9-11-17
This program will obtain the user's information and the radius of a circle.
Then the program should calculate the area and circumference of the circle,
and display them along with the user's info.
*******************/
#include <iostream>
using namespace std;
int main()
{
const double PI = 3.14; //pi value
int age; //age of the user
float gpa; //GPA of user
char gen; //gender of user
string firstName; //first name of user
float rad; //radius that user entered
float area; //area of the circle
float circ; //circumference of the circle
//INPUTS: Ask for the user's info
cout << "Enter your age: ";
cin >> age;
cout << "Enter your gpa: ";
cin >> gpa;
cout << "Enter your gender: ";
cin >> gen;
cout << "Enter your first name: ";
cin >> firstName;
cout << "Radius of the circle: ";
cin >> rad;
//PROCESS: Calculate circ and area
area = PI * rad * rad;
circ = 2 * PI * rad;
//OUTPUTS
cout << "Hello " << firstName << endl;
cout << "Your age is " << age << endl;
cout << "Your GPA is " << gpa << endl;
cout << "Your gender is " << gen << endl;
cout << "The area is " << area << endl;
cout << "The circumference is " << circ << endl;
return 0;
}