heimsventus

Perimeter and area dailies #2 problem 1 Ben Thompson

Jan 22nd, 2017
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.56 KB | None | 0 0
  1. // Perimeter dailiesnumber2.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <iostream>
  6. #include <string>
  7. using namespace std;
  8. int main()
  9. {
  10.     int width;
  11.     int length;
  12.     cout << "this program calculates area and perimeter, please enter in width" << endl;
  13.     cin >> width;
  14.     cout << "Now please enter in the length" << "\n";
  15.     cin >> length;
  16.  
  17.     int area = width* length;
  18.     int perimeter = length * 2 + width * 2;
  19.     cout << "area is " << area << "and perimeter is " << perimeter << "\n";
  20.     system("pause");
  21.     return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment