Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- typedef struct ajto{
- int ora;
- int perc;
- int az;
- string irany;
- } ajto;
- int main()
- {
- fstream f;
- f.open("ajto.txt",ios::in);
- ajto t[1000];
- int i=1;
- while(!f.eof()){
- f>>t[i].ora;
- f>>t[i].perc;
- f>>t[i].az;
- f>>t[i].irany;
- i++;
- }
- int db=i-2;
- cout<<t[5].irany<<endl;
- cout<<db<<endl;
- cout<<"1. Feladat"<<endl;
- i=1;
- while(i<=db){
- if(t[i].irany=="be"){
- cout<<t[i].az<<"ment be elsokent"<<endl;
- break;
- }
- i++; cout<<"1. Feladat"<<endl;
- }
- i=db;
- while(i>=0){
- if(t[i].irany=="ki"){
- cout<<t[i].az<<"ment ki utoljara"<<endl;;
- break;
- }
- i--;
- }
- cout<<"2. Feladat"<<endl;
- int a=1;
- int z[100];
- i=1;
- while(a<=100){
- i=1;
- while(i<=db){
- if(t[i].az==a)z[a]++;
- i++;
- }
- a++;
- }
- cout<<z[1]<<endl;
- f.close();
- f.open("athaladas.txt",ios::out);
- i=1;
- while(i<42){
- if(z[i]==0)i++;
- else{f<<i;
- f<<" ";
- f<<z[i];
- f<<" ";
- f<<endl;
- i++;}
- }
- f.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement