Advertisement
Guest User

Untitled

a guest
May 28th, 2015
261
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<<"Srednia cyfr wynosi: "<<kasia(cyfra1, wskaznik, cyfra2, sumczan)<<endl;
  24.     cout<<"Suma liczb wynosi: "<<suma<<endl;
  25.  
  26.     return 0;
  27. }
  28.  
  29.   float kasia (float liczba1, float *liczba2, float &liczba3, float *suma)
  30.  {
  31.    float srednia;
  32.   *suma= liczba1 + (*liczba2) + liczba3;
  33.   srednia = *suma/3;
  34.  
  35.     return srednia;
  36.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement