fork download
  1. #include <iostream>
  2. #include <string>
  3.  
  4.  
  5. using namespace std;
  6.  
  7.  
  8.  
  9. int main()
  10.  
  11.  
  12. {
  13.  
  14.  
  15. cout << "Hello World" << endl;
  16.  
  17. std::cout << "please enter the num of total (true and false)\n";
  18.  
  19. int n =0 ;
  20. cin >> n;
  21.  
  22.  
  23. string check [n] = {};
  24. int c;
  25. int x;
  26. for (int i = 0; i < n; i++)
  27. {
  28. std::cout << "please enter true of false \n";
  29. cin >> check[i];
  30. }
  31. for(int h=0; h<n; h++)
  32.  
  33. if (check[h]=="false")
  34. {
  35. x++;
  36. }
  37. else if (check[h] =="true")
  38. {
  39. c++;
  40. }
  41. cout << " the num of tr is " << c << " the num of fa is " << x << endl;
  42.  
  43. return 0;
  44.  
  45.  
  46. }
  47.  
  48.  
Success #stdin #stdout 0s 5288KB
stdin
Standard input is empty
stdout
Hello World
please enter  the num of total (true and false)
 the num of tr is  0 the num of fa is  0