fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <iostream>
  4.  
  5. using namespace std;
  6.  
  7. string vdv[4], ngaythidau[4];
  8. float chieucaonhay[4];
  9.  
  10. int main()
  11. {
  12. cout << "Ten van dong vien 1: ";
  13. getline(cin, vdv[1]);
  14. cout << "Ngay thi dau cua van dong vien 1: ";
  15. getline(cin, ngaythidau[1]);
  16. cout << "Chieu cao nhay cua van dong vien 1: ";
  17. cin >> chieucaonhay[1];
  18. if (chieucaonhay[1] < 2.0 || chieucaonhay[1] > 5.0) {
  19. cout << "Nhap lai";
  20. return 0;
  21. }
  22.  
  23. cout << "Ten van dong vien 2: ";
  24. cin.ignore();
  25. getline(cin, vdv[2]);
  26. cout << "Ngay thi dau cua van dong vien 2: ";
  27. getline(cin, ngaythidau[2]);
  28. cout << "Chieu cao nhay cua van dong vien 2: ";
  29. cin >> chieucaonhay[2];
  30. if (chieucaonhay[2] < 2.0 || chieucaonhay[2] > 5.0) {
  31. cout << "Nhap lai";
  32. return 0;
  33. }
  34.  
  35. cout << "Ten van dong vien 3: ";
  36. cin.ignore();
  37. getline(cin, vdv[3]);
  38. cout << "Ngay thi dau cua van dong vien 3: ";
  39. getline(cin, ngaythidau[3]);
  40. cout << "Chieu cao nhay cua van dong vien 3: ";
  41. cin >> chieucaonhay[3];
  42. if (chieucaonhay[3] < 2.0 || chieucaonhay[3] > 5.0) {
  43. cout << "Nhap lai";
  44. return 0;
  45. }
  46.  
  47. cout << vdv[1] << " " << ngaythidau[1] << " " << chieucaonhay[1] << endl;
  48. cout << vdv[2] << " " << ngaythidau[2] << " " << chieucaonhay[2] << endl;
  49. cout << vdv[3] << " " << ngaythidau[3] << " " << chieucaonhay[3] << endl;
  50.  
  51. return 0;
  52. }
Success #stdin #stdout 0s 5284KB
stdin
Standard input is empty
stdout
Ten van dong vien 1: Ngay thi dau cua van dong vien 1: Chieu cao nhay cua van dong vien 1: Nhap lai