Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- struct vairuotojas
- {
- string pav, nr;
- int tsk;
- };
- void skaityti(vairuotojas V[], int &n, string &nr1);
- void rasyti(vairuotojas V[], int n, string nr1);
- int main()
- {
- vairuotojas V[100];
- int n;
- string nr1;
- skaityti(V,n, nr1);
- rasyti(V,n,nr1);
- return 0;
- }
- void skaityti(vairuotojas V[], int &n, string &nr1)
- {
- ifstream in("duomenys.txt");
- in>>nr1;
- in>>n;
- char a[16];
- for(int i=0; i<n; i++)
- {
- in.ignore(80, '/n');
- in.get(a,16);
- V[i].pav=a;
- in.get(a,7);
- V[i].nr=a;
- in>>V[i].tsk;
- }
- in.close();
- }
- void rasyti(vairuotojas V[], int n, string nr1)
- {
- ofstream out("rezultatai.txt");
- out<<nr1<<endl;
- out<<n<<endl;
- for(int i=0; i<n; i++)
- {
- out<<V[i].pav<<" "<<V[i].nr<<" "<<V[i].tsk<<endl;
- }
- out.close();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement