fork(7) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void isASuperHero(bool canFly, bool isGood, bool isStrong);
  5.  
  6. int main() {
  7.  
  8. //Voldemort
  9. printf("Voldemort ");
  10. isASuperHero(true, false, true);
  11.  
  12. //Thor
  13. printf("Thor ");
  14. isASuperHero(false, true, true);
  15.  
  16. //Batman
  17. printf("Batman ");
  18. isASuperHero(false, true, false);
  19.  
  20. //Squidward
  21. printf("Squidward ");
  22. isASuperHero(false, false, false);
  23.  
  24. return 0;
  25. }
  26.  
  27. void isASuperHero(bool canFly, bool isGood, bool isStrong)
  28. {
  29. if(/*has a super power (strength or flight)*/)
  30. {
  31. if(/*must not be evil*/)
  32. {
  33. printf("is a super hero.\n");
  34. }
  35. else
  36. {
  37. printf("is a super villian.\n");
  38. }
  39. }
  40. else
  41. {
  42. if(!isGood)
  43. {
  44. printf("is mean but otherwise ");
  45. }
  46. printf("is a normal person.\n");
  47. }
  48.  
  49. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘void isASuperHero(bool, bool, bool)’:
prog.cpp:29:47: error: expected primary-expression before ‘)’ token
  if(/*has a super power (strength or flight)*/)
                                               ^
prog.cpp:31:26: error: expected primary-expression before ‘)’ token
   if(/*must not be evil*/)
                          ^
stdout
Standard output is empty