fork download
  1. // My Bar
  2.  
  3. #include <iostream>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. int age; // declare variable
  9.  
  10. cout << "At this bar you have to be 21 and up to be in hereby the way, how old are you?\n"; // Ask primary question
  11. cin >> age; // retrieve personal information
  12. cout << age << endl;
  13. cin.get ();
  14.  
  15. if (age > 21)
  16. {
  17. cout << "You could've fooled me... What you're having?\n"; // allow access
  18. }
  19. else (age == 21)
  20. {
  21. cout << "You're Ok\n"; // barely allow access
  22. }
  23. else
  24. {
  25. cout << "Get the F*** out of my bar!!!\n"; // deny access
  26. }
  27. }
  28.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:20: error: expected `;' before ‘{’ token
prog.cpp:23: error: ‘else’ without a previous ‘if’
stdout
Standard output is empty