SHARE
TWEET

Untitled

a guest May 21st, 2019 107 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <math.h>
  3.  
  4. using namespace std;
  5.  
  6. void calculateCube(float, float*);
  7.  
  8. int main()
  9. {
  10.     const int size = 2;
  11.     float result [size];
  12.     float cubeSize;
  13.  
  14.     printf("Bitte gew\x81nschte Seitenl\x84nge des W\x81rfels in cm angeben:");
  15.     cin >> cubeSize;
  16.  
  17.     calculateCube(cubeSize, result);
  18.  
  19.     printf("Das Volumen des W\x81rfels mit Seitenl\x84nge %.2f betr\x84gt %.2fcm\n", cubeSize, result[0]);
  20.     printf("Die Oberfl\x84che des W\x81rfels mit Seitenl\x84nge %.2f betr\x84gt %.2fcm\n", cubeSize, result[1]);
  21.  
  22.     return 0;
  23. }
  24.  
  25. void calculateCube(float size, float *result)
  26. {
  27.     float volume = pow(size, 3);
  28.     float surface = 6 * pow(size, 2);
  29.    
  30.     result[0] = volume;
  31.     result[1] = surface;
  32. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top