Advertisement
Guest User

Untitled

a guest
May 28th, 2015
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.78 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.   float kasia (float liczba1, float *liczba2, float &liczba3, float *suma);
  5.  
  6. int main()
  7. {
  8.     float cyfra1, cyfra2, cyfra3, suma=0;
  9.     float *wskaznik, *sumczan;
  10.  
  11.     wskaznik= &cyfra2;
  12.     sumczan= &suma;
  13.  
  14.     cout << "Licze sume i srednia" << endl;
  15.     cout<< "Podaj 3 liczby: "<<endl;
  16.     cout <<"<<  ";
  17.     cin>>cyfra1;
  18.     cout<<"<<  ";
  19.     cin>>cyfra2;
  20.     cout<<"<<  ";
  21.     cin>>cyfra3;
  22.  
  23.     cout<<"Suma liczb wynosi: "<<suma<<endl;
  24.     cout<<"Srednia cyfr wynosi: "<<kasia(cyfra1, wskaznik, cyfra2, sumczan);
  25.     return 0;
  26. }
  27.  
  28.   float kasia (float liczba1, float *liczba2, float &liczba3, float *suma)
  29.  {
  30.    float srednia;
  31.   *suma= liczba1 + (*liczba2) + liczba3;
  32.   srednia = *suma/3;
  33.  
  34.     return srednia;
  35.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement