Advertisement
Guest User

Untitled

a guest
Sep 25th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstring>
  3. using namespace std;
  4. struct student
  5. {
  6. string data;
  7. string data1;
  8. string data2;
  9. string data3;
  10. };
  11.  
  12. main()
  13. {
  14. while (1)
  15. {
  16. int num, i;
  17. cin >> num;
  18.  
  19. struct student data[num];
  20. string temp;
  21. for (i = 0; i < num; i++)
  22. {
  23. cin >> temp;
  24. data[i].data = temp;
  25. cin >> temp;
  26. data[i].data1 = temp;
  27. cin >> temp;
  28. data[i].data2 = temp;
  29. cin >> temp;
  30. data[i].data3 = temp;
  31. }
  32. int test_number;
  33. cin >> test_number;
  34. while (test_number--)
  35. {
  36. int i;
  37. string test;
  38. cin >> test;
  39.  
  40. for (i = 0; i < num; i++)
  41. {
  42. if (test[2] == data[i].data[2])
  43. {
  44. cout << data[i].data << " " << data[i].data1 << " "
  45. << data[i].data2 << " " << data[i].data3 << endl;
  46.  
  47. break;
  48. }
  49. else if (i == num - 1)
  50. {
  51. cout << "No Answer!" << endl;
  52. }
  53. }
  54. }
  55.  
  56. }
  57. return 0;
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement