fork download
  1. #include <stdio.h>
  2. #include <iostream>
  3. #include <stdlib.h>
  4. using namespace std;
  5.  
  6. int main() {
  7. int meuArray[5];
  8. int myArray[5] = {1,2,3,4,5};
  9. bool hungry = false;
  10. int A[] = {1337, 1395338051, 1432046676, 1565151813};
  11. long long int *p;
  12. char palavra[] = "Tem gente dormindo aqui!";
  13. int *v0, *v1,*v2;
  14. p = (long long int *)A;
  15.  
  16.  
  17. cout << palavra <<endl;
  18.  
  19. v0 = (int*)malloc(3*sizeof(int));
  20. v1 = (int*)malloc(3*sizeof(int));
  21. v2 = (int*)malloc(3*sizeof(int));
  22.  
  23. v0[0] = 1;
  24. v0[1] = 2;
  25. v0[2] = 3;
  26. v1[0] = 4;
  27. v1[1] = 5;
  28. v1[2] = 6;
  29. v2[0] = 7;
  30. v2[1] = 8;
  31. v2[2] = 9;
  32.  
  33. int **M;
  34. M = (int**)malloc(3*sizeof(int*));
  35. M[0] = v0;
  36. M[1] = v1;
  37. M[2] = v2;
  38.  
  39. for (int k=0; k<3; k++){
  40. for (int l=0;l<3;l++){
  41. cout << M[k][l]<< ' ';
  42. }
  43. cout << endl;
  44. }
  45.  
  46. }
  47.  
  48.  
  49. for (int j=0;j<4;j++){
  50. cout << *(A+j) << '|' << *(p+j) <<endl;
  51. }
  52.  
  53.  
  54. for (int i=0;i<5; i++){
  55. meuArray[i]=i*10;
  56. }
  57.  
  58. while (hungry){
  59. printf("Comendo!\n");
  60. hungry = false;
  61. }
  62.  
  63. do{
  64. printf("Comendo!!\n");
  65.  
  66. }while(hungry);
  67.  
  68. std:cout <<"Hello world c++!" <<endl;
  69. printf("Hello World c");
  70.  
  71.  
  72.  
  73. return 0;
  74. }
Compilation error #stdin compilation error #stdout 0s 15240KB
stdin
Standard input is empty
compilation info
prog.cpp:49:2: error: expected unqualified-id before ‘for’
  for (int j=0;j<4;j++){
  ^~~
prog.cpp:49:15: error: ‘j’ does not name a type
  for (int j=0;j<4;j++){
               ^
prog.cpp:49:19: error: ‘j’ does not name a type
  for (int j=0;j<4;j++){
                   ^
prog.cpp:54:2: error: expected unqualified-id before ‘for’
  for (int i=0;i<5; i++){
  ^~~
prog.cpp:54:15: error: ‘i’ does not name a type
  for (int i=0;i<5; i++){
               ^
prog.cpp:54:20: error: ‘i’ does not name a type
  for (int i=0;i<5; i++){
                    ^
prog.cpp:58:2: error: expected unqualified-id before ‘while’
  while (hungry){
  ^~~~~
prog.cpp:63:2: error: expected unqualified-id before ‘do’
  do{
  ^~
prog.cpp:66:3: error: expected unqualified-id before ‘while’
  }while(hungry);
   ^~~~~
prog.cpp:68:5: error: found ‘:’ in nested-name-specifier, expected ‘::’
  std:cout <<"Hello world c++!" <<endl;
     ^
prog.cpp:68:6: error: ‘cout’ in namespace ‘std’ does not name a type
  std:cout <<"Hello world c++!" <<endl;
      ^~~~
In file included from prog.cpp:2:0:
/usr/include/c++/6/iostream:61:18: note: ‘std::cout’ declared here
   extern ostream cout;  /// Linked to standard output
                  ^~~~
prog.cpp:69:8: error: expected constructor, destructor, or type conversion before ‘(’ token
  printf("Hello World c");
        ^
prog.cpp:73:2: error: expected unqualified-id before ‘return’
  return 0;
  ^~~~~~
prog.cpp:74:1: error: expected declaration before ‘}’ token
 }
 ^
stdout
Standard output is empty