-2

I started to use sublime text 2 editor today to write c/c++ programs, but when I run this code

#include <cstdio>
int main(){
    int n;
     scanf("%d",&n);
     printf("%d\n",n);
     return 0;
}

I am expecting the compiler to ask for an input. but instead, it just prints the initial value of (n) which is garbage. How can i insert an input ?

Omar
  • 801
  • 3
  • 10
  • 20

1 Answers1

1

I suppose what you want to do is input data in the same panel where Sublime Text show results, well friend, you can't.

The only thing you can do is configure Sublime Text for running the compiled program in an external terminal. The link chris provide you is a good start.

On the other hand when you say: expecting the compiler to ask for an input, is a conceptual error. The compiler is not whom is expecting the input. The input is being expected by the compiled program.

Raydel Miranda
  • 13,825
  • 3
  • 38
  • 60