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