Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*** Aufgabe_04_2c.cpp ***/
- #include <iostream>
- using namespace std;
- //***************************************************************
- int produkt_summe_und_differenz(int z1, int z2, int* prod, int& sum){
- sum = z1 + z2;
- prod = z1 * z2;
- return (z1 - z2); //Gibt Differenz zurΓΌck
- }
- //***************************************************************
- int main() {
- int const zahl1 = 148, zahl2 = -62;
- int produkt, summe, differenz;
- //**************************************************
- int *psumme = &summe;
- int *pprodukt = &produkt;
- differenz = produkt_summe_und_differenz(zahl1, zahl2, pprodukt, psumme);
- summe = *psumme;
- produkt = *pprodukt;
- //**************************************************
- cout << "Produkt: " << produkt << endl;
- cout << "Summe: " << summe << endl;
- cout << "Differenz: " << differenz << endl;
- return 0;
- }
- /* Ausgabe:
- Produkt: 4201088
- Summe: 1964862637
- Differenz: 1964862394
- */
- /*** Ende Aufgabe_04_2c.cpp ***/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement