Advertisement
Guest User

Untitled

a guest
Nov 14th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. /*** Aufgabe_04_2c.cpp ***/
  2. #include <iostream>
  3. using namespace std;
  4. //***************************************************************
  5. int produkt_summe_und_differenz(int z1, int z2, int* prod, int& sum){
  6. sum = z1 + z2;
  7. prod = z1 * z2;
  8. return (z1 - z2); //Gibt Differenz zurΓΌck
  9. }
  10.  
  11. //***************************************************************
  12. int main() {
  13. int const zahl1 = 148, zahl2 = -62;
  14. int produkt, summe, differenz;
  15. //**************************************************
  16. int *psumme = &summe;
  17. int *pprodukt = &produkt;
  18. differenz = produkt_summe_und_differenz(zahl1, zahl2, pprodukt, psumme);
  19. summe = *psumme;
  20. produkt = *pprodukt;
  21. //**************************************************
  22. cout << "Produkt: " << produkt << endl;
  23. cout << "Summe: " << summe << endl;
  24. cout << "Differenz: " << differenz << endl;
  25. return 0;
  26.  
  27.  
  28. }
  29. /* Ausgabe:
  30. Produkt: 4201088
  31. Summe: 1964862637
  32. Differenz: 1964862394
  33. */
  34. /*** Ende Aufgabe_04_2c.cpp ***/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement