Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- int main()
- {
- ofstream fout("plik.txt");
- for(int i=1;i<=16;i++)
- {
- fout<<i<<endl;
- }
- fout.close();
- ifstream fin("plik.txt");
- int tab[16];
- int i=0;
- while(!fin.eof())
- {
- fin>>tab[i];
- i++;
- }
- for(int i=0;i<16;i++)
- {
- if(tab[i]<15)cout<<tab[i]<<",";
- }
- float srednia = 0;
- int a = 0;
- i=0;
- for(int i=0;i<16;i++)
- {
- if(tab[i]<11)
- {
- a++;
- srednia+=tab[i];
- }
- }
- srednia/=a;
- cout<<endl<<srednia;
- ofstream fout2("plik2.txt");
- for(int i=0;i<16;i++)
- {
- if(tab[i]%3!=0)fout2<<tab[i]<<endl;
- }
- fout2.close();
- cout<<endl;
- ifstream fin2("plik2.txt");
- while(!fin2.eof())
- {
- int x;
- fin2>>x;
- cout<<x<<",";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement