Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <ctime>
- #include <cstdlib>
- #include <math.h>
- #include <sstream>
- using namespace std;
- void podpunkt_a(int n)
- {
- ofstream fout("wynik1.txt");
- string im, naz, m, tel;
- int wie;
- for(int i=0;i<n;i++)
- {
- cout<<"Dane "<<i<<" studenta"<<endl;
- cout<<"Imie: ";
- cin>>im;
- cout<<"Nazwisko: ";
- cin>>naz;
- cout<<"Wiek: ";
- cin>>wie;
- cout<<"Miejsce urodzenia: ";
- cin>>m;
- cout<<"Telefon: ";
- cin>>tel;
- fout<<im<<" "<<naz<<"\t"<<wie<<"\t"<<m<<"\t"<<tel<<endl;
- }
- fout.close();
- }
- void podpunkt_b(int n)
- {
- ifstream fin("wynik1.txt");
- ofstream fout("podpunkt_b.txt");
- string im, naz, wie, m, tel;
- for(int i=0;i<n;i++)
- {
- fin>>im>>naz>>wie>>m>>tel;
- fout<<im<<" "<<naz<<"\t"<<wie<<"\t"<<m<<"\t"<<tel<<endl;
- }
- fout.close();
- fin.close();
- }
- void podpunkt_c(int n)
- {
- ifstream fin("wynik1.txt");
- ofstream fout("podpunkt_c.txt");
- string im, naz, wie, m, tel;
- for(int i=0;i<n;i++)
- {
- fin>>im>>naz>>wie>>m>>tel;
- fout<<naz<<"\t"<<tel<<endl;
- }
- fout.close();
- fin.close();
- }
- void podpunkt_d(int n)
- {
- ifstream fin("wynik1.txt");
- ofstream fout("podpunkt_d.txt");
- string im;
- string naz;
- int wie;
- string m;
- string tel;
- int wiek;
- for(int i=0;i<n;i++)
- {
- wiek+=wie;
- cout<<wiek<<endl;
- }
- cout<<wiek/n<<endl;
- }
- int main()
- {
- int n;
- cout<<"Podaj liczbe studentow: ";
- cin>>n;
- //podpunkt_a(n);
- podpunkt_b(n);
- podpunkt_c(n);
- podpunkt_d(n);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement