I have been trying to use Visual Studio to run my C++ codes, but I couldn't find a way around it. I came across this extension called C/C++ Compile Run, which was simple to use. I also use the standard C/C++ Microsoft Extension.
I then tried it out by running this code:
#include<iostream>
using namespace std;
int main(){
cout<<"hello";
char x[10];
cout<<"\nEnter a string please: ";
gets(x);
puts(x);
}
I forgot to include stdio.h
, but the code compiled successfully with the C/C++ Compile Run extension. It gave this output:
hello Enter a string please: string string
But, I didn't include stdio.h
. Is there any way to fix this? Or should I try another way of compiling my C++ code?