wheelsmanx

CPS 171 Machine Problem 1

Oct 17th, 2016
347
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. // ConsoleApplication3.cpp : Defines the entry point for the console application.
  2. //
  3. #include "stdafx.h"
  4. #include <iostream>
  5. #include <string>
  6. #include <math.h>
  7. // an example of a prime number is a number that is only divisible by its self and 1
  8.  
  9. using namespace std;
  10.  
  11.  
  12. float inputvariable;
  13. float radius;
  14. float pi;
  15. float circle;
  16. float square;
  17. float inputsquare;
  18. float difference;
  19. float roundupvariable;
  20. float rounddownvariable;
  21.  
  22. int main()
  23. {
  24. cout << "Please Enter Variable in CM" << endl;
  25. cin >> inputvariable;
  26. pi = 3.14159;
  27. inputsquare = inputvariable * inputvariable;
  28. square = inputsquare / 100;
  29. cout << "The area of your square is: " << square << " Meters" << endl;
  30. circle = pi * inputsquare;
  31. circle = circle / 100;
  32. cout << "The area of your circle is: " << circle << " Meters" << endl;
  33. difference = circle - square;
  34. cout << "The difference of the two shapes is: " << difference << " Meters" << endl;
  35. roundupvariable = ceil(inputvariable);
  36. roundupvariable = roundupvariable * roundupvariable * roundupvariable;
  37. rounddownvariable = floor(inputvariable);
  38. rounddownvariable = rounddownvariable * rounddownvariable * rounddownvariable;
  39. cout << " A Cube with your variable rounded up is " << roundupvariable << " Meters" << endl;
  40. cout << " A Cube with your variable rounded down is " << rounddownvariable << " Meters" << endl;
  41.  
  42.  
  43.  
  44.  
  45. system("pause");
  46. return 0;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment