0

enter image description here I can't type anything in output I want to do normal code

#include <iostream>
using namespace std;

int main()

{
    int a , b;
    //reserving for variable
    int sum;
    cout << "Enter a number \n";
    cin >> a;
    cout << "enter another number \n";
    cin >> b;
    sum = a + b;
    cout << "Sum is " << sum << endl;

    return 0;
}

this is my code. Every time I try entering a number nothing happens.

Carlo Wood
  • 5,648
  • 2
  • 35
  • 47
Shiv
  • 1
  • 1
  • From the screenshot, you entered `/n` not a number. – Ch3steR Sep 02 '22 at 07:41
  • How is the program being invoked? Ex. are you using an extension? tasks.json? Maybe the way it's being run doesn't realize that it should be waiting for user input and thinks it will get all its input from stdin "immediately". – starball Sep 02 '22 at 07:42
  • The code itself is ok, your problem is your setting. But how should we know what is wrong. Tell us more about your environment. Maybe you need to install "code runner" extension. – YesThatIsMyName Sep 02 '22 at 07:44
  • Maybe this answer can help you: https://stackoverflow.com/questions/36964949/visual-studio-code-take-input-from-user – YesThatIsMyName Sep 02 '22 at 07:46
  • 2
    What is Vi**rt**ual Studio Code? :) – user1810087 Sep 02 '22 at 07:56

0 Answers0