Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. void dataPorFichero(tColeccionEmpleados &zara){
  2. ifstream file;
  3. char filename[50];
  4. cin.getline(filename, 50);
  5. file.open(filename);
  6.  
  7. if(!file.is_open()){
  8. cerr << "The file is not open" << endl;
  9. exit(1);
  10. }
  11.  
  12. int counter = 0;
  13. while(file.good()){
  14.  
  15. file >> zara.listaEmpleados[counter].date.day;
  16. file >> zara.listaEmpleados[counter].date.month;
  17. file >> zara.listaEmpleados[counter].date.year;
  18. file >> zara.listaEmpleados[counter].dptmnt;
  19. file >> zara.listaEmpleados[counter].identifier;
  20. file >> zara.listaEmpleados[counter].salary;
  21.  
  22. cout << "The identifier for this employe is: " << zara.listaEmpleados[counter].identifier << endl;
  23. cout << "The date this employe was registered is: " << zara.listaEmpleados[counter].date.day << " of " << zara.listaEmpleados[counter].date.month << " of " << zara.listaEmpleados[counter].date.year << endl;
  24. counter++;
  25. }
  26. file.close();
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement