1

I am using VScode in windows with mingw. I have installed the C/C++ extension and properly configured the Intellisense mode and tasks.json (I followed this tutorial https://code.visualstudio.com/docs/cpp/config-mingw#_build-helloworldcpp). Everything works fine until I use string. I am able to use other data types and containers without any problem.

#include<bits/stdc++.h>
using namespace std;
int main()
{
    cout<<"working";
    string s;
    cin>>s;
    cout<<s;
    return 0;
}

The program terminates without printing anything, though it doesn't throw any error.

Arvinth
  • 11
  • 3
  • You didn't `#include ` – asmmo Jan 12 '20 at 00:37
  • 1
    `#include` -- Use the proper headers, not this one. – PaulMcKenzie Jan 12 '20 at 00:55
  • 1
    See [Why should I not #include ?](https://stackoverflow.com/q/31816095/10871073). – Adrian Mole Jan 12 '20 at 03:29
  • @Carcigenicate, yeah I am pretty sure that the program terminated. I am using Powershell terminal and I can see the next command line. – Arvinth Jan 12 '20 at 04:21
  • @AdrianMole, thank you. I learnt something. As far as I understand, the problem may arise if the header is incompatible with the compiler. But the other functions are working well. It would be nice if you elaborate – Arvinth Jan 12 '20 at 04:37
  • I also tried using `#include` and `#include` instead of `#include`. Still the situation remains the same – Arvinth Jan 12 '20 at 04:46

0 Answers0