fork download
  1. #include <iostream>
  2. using namespace std;
  3. class Logar
  4. {
  5. public:
  6. int a;
  7. Logar(int z);
  8. };
  9. Logar(k)
  10. {a = k;
  11. if(a == 040)
  12. { cout>> "Logado!";}
  13. }
  14. int main() {
  15. // your code goes here
  16. Logar r(040);
  17. return 0;
  18. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:9:9: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11 [enabled by default]
  Logar(k)
         ^
prog.cpp:10:3: error: ‘a’ was not declared in this scope
  {a = k;
   ^
prog.cpp:10:8: error: expected ‘}’ before ‘;’ token
  {a = k;
        ^
prog.cpp:10:8: error: in C++98 ‘k’ must be initialized by constructor, not by ‘{...}’
prog.cpp:10:8: error: no matching function for call to ‘Logar::Logar(<brace-enclosed initializer list>)’
prog.cpp:10:8: note: candidates are:
prog.cpp:7:3: note: Logar::Logar(int)
   Logar(int z);
   ^
prog.cpp:7:3: note:   no known conversion for argument 1 from ‘<type error>’ to ‘int’
prog.cpp:3:7: note: Logar::Logar(const Logar&)
 class Logar
       ^
prog.cpp:3:7: note:   no known conversion for argument 1 from ‘<type error>’ to ‘const Logar&’
prog.cpp:11:3: error: expected unqualified-id before ‘if’
   if(a == 040)
   ^
prog.cpp:13:2: error: expected declaration before ‘}’ token
  }
  ^
stdout
Standard output is empty