fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. string x, 61, 71, 11, 21, 32, 19, 27, 31;
  7. 61 = "Brasilia";
  8. 71 = "Salvador";
  9. 11 = "Sao Paulo";
  10. 21 = "Rio de Janeiro";
  11. 32 = "Juiz de Fora";
  12. 19 = "Campinas";
  13. 27 = "Vitoria";
  14. 31 = "Belo Horizonte";
  15.  
  16. cout << "Digite o DDD:";
  17. cin >> x;
  18. if { x == 61;
  19. cout << 61 ;
  20. else { x == 71;
  21. cout << 71 ;
  22. else { x == 11;
  23. cout << 11 ;
  24. else { x == 21;
  25. cout << 21 ;
  26. else { x == 32;
  27. cout << 32 ;
  28. else { x == 19;
  29. cout << 19 ;
  30. else { x == 27;
  31. cout << 27 ;
  32. else { x == 31;
  33. cout << 31 ;
  34. else { cout << "DDD nao cadastrado" };
  35.  
  36. return 0;
  37.  
  38.  
  39. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:6:12: error: expected unqualified-id before numeric constant
  string x, 61, 71, 11, 21, 32, 19, 27, 31;
            ^
prog.cpp:7:5: error: lvalue required as left operand of assignment
  61 = "Brasilia";
     ^
prog.cpp:8:6: error: lvalue required as left operand of assignment
   71 = "Salvador";
      ^
prog.cpp:9:5: error: lvalue required as left operand of assignment
  11 = "Sao Paulo"; 
     ^
prog.cpp:10:5: error: lvalue required as left operand of assignment
  21 = "Rio de Janeiro"; 
     ^
prog.cpp:11:5: error: lvalue required as left operand of assignment
  32 = "Juiz de Fora";
     ^
prog.cpp:12:5: error: lvalue required as left operand of assignment
  19 = "Campinas";
     ^
prog.cpp:13:5: error: lvalue required as left operand of assignment
  27 = "Vitoria";
     ^
prog.cpp:14:5: error: lvalue required as left operand of assignment
  31 = "Belo Horizonte";
     ^
prog.cpp:18:5: error: expected '(' before '{' token
  if { x == 61; 
     ^
prog.cpp:39:1: error: expected '}' at end of input
 }
 ^
stdout
Standard output is empty