You are on page 1of 3

Michael Gebhardt CT-115 Introduction to Programming C++ D02 Submitted 9/12/11

//perimeterCircleV1.cpp //Michael Gebhardt //program calculates perimeter of a circle //perimeter = PI * diameter //diameter = 2 * radius #include <iostream> using namespace std; int main() { //declaration const double PI = 3.141592; double radius, diamter, perimeter;

//assignment cout << "Enter radius of circle: "; cin >> radius;

//processing diameter = 2 * radius; permiter = PI * diamter;

//output cout << "Perimeter for circle with input value is " << perimeter << endl;

system("PAUSE"); return 0; }

//rectangleVolumeV1.cpp //Michael Gebhardt //program calculates area of a rectangle //volume = length * width * height #include <iostream> using namespace std; int main() { //declaration double length, width, height, volume;

//assignment cout << "Enter length: "; cin >> length; cout << "Enter width: "; cin >> width; cout << "Enter height: "; cin >> height;

//processing volume = length * width * height;

//output cout << "Volume for a rectangular prism with input values is " << volume << + " cubic units" << endl; system("PAUSE"); return 0; }

You might also like