Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- const char FV[]="duom.txt";
- const char FD[]="rez.txt";
- void skaityk(int M[], int A[]);
- void rasyk(int M[]);
- int main()
- {
- int M[100];
- int A[100];
- skaityk(M,A);
- rasyk(M);
- }
- void skaityk(int M[], int A[])
- {
- ifstream fd(FV);
- for(int i=0; i<=10; i++)
- {
- fd>>M[i];
- A[i]=10-M[i];
- };
- for(int b=11; b<=20; b++)
- {
- M[b]=0;
- A[b]=0;
- }
- for(int n=0; n<20; n++)
- while(A[n]>0)
- for(int a=(n+1);a<=20; a++)
- {
- M[a]++;
- A[n]--;
- };
- fd.close();
- }
- void rasyk(int M[])
- {
- ofstream fv(FD);
- for(int i=0; i<=20; i++)
- fv<<M[i]<<" ";
- fv.close();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement