Advertisement
Guest User

Untitled

a guest
Oct 25th, 2016
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3.  
  4. using namespace std;
  5.  
  6. void read (int &ak,int &bk,int &rk,int &n,double a[],double b[],double r[] );
  7. void skai (int &ak,int &bk,int &rk,int &n,double &a,double &b,double &r);
  8. void outt (int n, double aa,double bb,double rr, double kk);
  9. double a[10];double b[10];double r[10];
  10.  
  11. int main() {
  12. int ak,bk,rk,n;
  13.  
  14. double aa,bb,rr,kk;
  15. read (ak,bk,rk,n,a,b,r);
  16. // skai (ak,bk,rk,n,a,b,r);
  17. outt (n,aa,bb,rr,kk);
  18. return 0;
  19. }
  20.  
  21. void read (int &ak,int &bk,int &rk,int &n,double a[],double b[],double r[] ){
  22.  
  23. ifstream fd ("duom.txt");
  24. fd>>ak>>bk>>rk;
  25. fd>>n;
  26. for (int i=0;i<n;i++)
  27. fd>>a[i]>>b[i]>>r[i];
  28. fd.close();
  29. }
  30. void skai(int &ak,int &bk,int &rk,int &n,double &a,double &b,double &r){
  31. double aa,bb,rr,kk;
  32. for (int i=0;i<n;i++){
  33. aa=(a/ak);
  34. bb=(b/bk);
  35. rr=(r/rk);
  36. kk=100-(aa+bb+rr);
  37. }
  38. }
  39.  
  40. void outt(int n,double aa,double bb,double rr, double kk){
  41. ofstream fr ("rezz.txt");
  42. for (int i=0;i<n;i++)
  43. fr<<a[i]<<b[i]<<r[i]<<endl;
  44. // fr<<aa<<" "<<bb<<" "<<rr<<" "<<kk<<" "<<endl;
  45. fr.close();
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement