Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- const double pi = 3.14159;
- int main()
- {
- double area, circum, diam, rad;
- cout << "Enter radius : " << flush;
- cin >> rad;
- string ynarea;
- cout << "Print Area? (y/n) " << flush;
- cin >> ynarea;
- string yncircum = "";
- cout << "Print Circumference? (y/n) " << flush;
- cin >> yncircum;
- string yndiam = "";
- cout << "Print Diameter? (y/n) " << flush;
- cin >> yndiam;
- area = pi * rad * rad;
- circum = pi * rad * 2.0;
- diam = rad * 2.0;
- if( ynarea == "y" || "Y" )
- {
- cout << "Area is " << area << endl;
- }
- else
- {
- cout << endl;
- }
- if( yncircum == "y" || "Y" )
- {
- cout << "Circumference is " << circum << endl;
- }
- if( yndiam == "y" || "Y" )
- {
- cout << "Diameter is " << diam << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement