fork download
  1. #include <iostream>
  2. using namespace std;
  3. struct Doctors{
  4. string first_name;
  5. string last_name;
  6. string spec;
  7. int years;
  8. };
  9. void read_doc(Doctors &x){
  10. cin>>x.first_name;
  11. cin>>x.last_name;
  12. cin>>x.spec;
  13. cin>>x.years;
  14. }
  15. void write_doc(Doctors &x){
  16. cout<<x.first_name<<" ";
  17. cout<<x.last_name<<" ";
  18. cout<<x.spec<<" ";
  19. cout<<x.years<<" ";
  20. }
  21.  
  22. int main() {
  23. Doctors doctor[4];
  24. int n=4;
  25. for(int i=0;i<n;++i){
  26. cin>>doctor[i].first_name;
  27. cin>>doctor[i].last_name;
  28. cin>>doctor[i].spec;
  29. cin>>doctor[i].years;
  30. }
  31. for(int i=0;i<n;++i){
  32. cout<<doctor[i].first_name<<" ";
  33. cout<<doctor[i].last_name<<" ";
  34. cout<<doctor[i].spec<<" ";
  35. cout<<doctor[i].years<<endl;
  36. }
  37. return 0;
  38. }
Success #stdin #stdout 0s 544KB
stdin
sajhs skdjksad okulist 15
anton anton lor 12
olya olya terapevt 10
vova vova  hirurg 22
stdout
sajhs skdjksad okulist 15
anton anton lor 12
olya olya terapevt 10
vova vova hirurg 22