Sublime Text usually requires better understand of inner workings of things, i.e., study much more, and for a beginner, Visual Studio Community, should be easier to learn C++:
Your original code will not work as @wbond explained. You cannot do input with Sublime Text build system. You need to either use another editor or learn/study more about Sublime Text. I would suggest you to give a try on VSCode. May be it will be easier for you to learn. Otherwise, stick with Visual Studio Community.
An alternative to what @addons_zz is if you like Sublime Text is to use it as your text editor.
IDEs tend to try to put all tools into one application, so you don’t have a lot of options in what parts to use. Text editors tend to focus more energy on the editing of the code, and leave all of the other tasks to specialized tools.
If you use Sublime Text as your text editor, you can use something like PowerShell to compile and execute the code. Most software projects have tools/systems to build that are separate from an IDE. Using a full terminal program for invoking and interacting with your compiled program allows you to utilize all of the features that terminal, and use the one that best fits your requirements and preferences.
For what its worth, that is how I work when working on Sublime Text. I use Sublime Text to write the code, and I build and run the program in my favorite terminal on each platform.
I also do it sometimes either when I did not get the time to integrate it with the Sublime Text build system, or because it cannot be integrated due usage of non-supported features by Sublime Text as cin. The advantage of integrating an external build system with Sublime Text are features like file_regex, which allow directly double-clicking the error messages and jumping directly to the source code line, and even showing the error messages directly above the source code line (inline error messages, phantoms).
Other advantages are the ones provided by packages like https://github.com/asfaltboy/SublimeTestPlier for Python. It does parse the current source code file and detect on which Unit Test I have around the cursor/caret. Then, allows you to run directly only that test. Additionally, in my fork of the package, I allowed it to remember and run the last test it had ran, then, I can directly run the last test when I am browsing the source code (i.e., fixing a test on TDD). These functionalities, are usually provided out of the box by IDE’s while you can integrate them into text editors by robust extensions. I just hope in the future, Sublime Text manages to fix and complete its API, then, features like these and even more robust, can be directly integrated by extensions.
Another point for IDE’s are the integrated debuggers, there are some years I do not use any of them and just code everything directly with Sublime Text as my sole editor. However, the other day, I almost had to recur to one of them because Python was exiting with failure status, while no errors/exceptions whatsoever where being printed to the screen. The problem was on Python system shutdown (object destruction). The stream sys.stderr already had been destroyed when the exception occurred, then, the only thing Python could do was to exit with an error status code. How am I supposed to fix something, if cannot print anything to the screen and I have no ideia from where it is coming? I got lucky and manage to fix it by reading the documentation and online forums, then, without recurring to either a graphical or command line step by step debuggers.