Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- void read (int &ak,int &bk,int &rk,int &n,double a[],double b[],double r[] );
- void skai (int &ak,int &bk,int &rk,int &n,double &a,double &b,double &r);
- void outt (int n, double aa,double bb,double rr, double kk);
- double a[10];double b[10];double r[10];
- int main() {
- int ak,bk,rk,n;
- double aa,bb,rr,kk;
- read (ak,bk,rk,n,a,b,r);
- // skai (ak,bk,rk,n,a,b,r);
- outt (n,aa,bb,rr,kk);
- return 0;
- }
- void read (int &ak,int &bk,int &rk,int &n,double a[],double b[],double r[] ){
- ifstream fd ("duom.txt");
- fd>>ak>>bk>>rk;
- fd>>n;
- for (int i=0;i<n;i++)
- fd>>a[i]>>b[i]>>r[i];
- fd.close();
- }
- void skai(int &ak,int &bk,int &rk,int &n,double &a,double &b,double &r){
- double aa,bb,rr,kk;
- for (int i=0;i<n;i++){
- aa=(a/ak);
- bb=(b/bk);
- rr=(r/rk);
- kk=100-(aa+bb+rr);
- }
- }
- void outt(int n,double aa,double bb,double rr, double kk){
- ofstream fr ("rezz.txt");
- for (int i=0;i<n;i++)
- fr<<a[i]<<b[i]<<r[i]<<endl;
- // fr<<aa<<" "<<bb<<" "<<rr<<" "<<kk<<" "<<endl;
- fr.close();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement