Advertisement
Guest User

Untitled

a guest
Jan 25th, 2020
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.87 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. double addition (double x, double y){
  6.     double z = x + y;
  7.     return z;
  8. }
  9.  
  10. double subtraction (double x, double y){
  11.     double z = x - y;
  12.     return z;
  13. }
  14.  
  15. double square (double x){
  16.     double z = x * x;
  17.     return z;
  18. }
  19.  
  20. double cube (double x){
  21.     double z = x * x * x;
  22.     return z;
  23. }
  24.  
  25. double squareroot (double x){
  26.     double z = sqrt (x);
  27.     return z;
  28. }
  29.  
  30. double squarecube (double x){
  31.     double z = pow(x, 1.0/3.0);
  32.     return z;
  33. }
  34.  
  35. int main (){
  36.     cout << "the first answer is: " << addition (4, 45.45) << endl;
  37.     cout << "the second answer is: " << subtraction (4, 45.45) << endl;
  38.     cout << "the third answer is: " << square (45.45) << endl;
  39.     cout << "the forth answer is: " << cube (45.45) << endl;
  40.     cout << "the fifth answer is: " << squareroot (45.45) << endl;
  41.     cout << "the sixth answer is: " << squarecube (45.45);
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement