r/CodingHelp • u/Gordon-III • Jan 02 '22
[Request Coders] How to declare a variable that will allow a user to input text in C++ ?
5
u/MarkRems Jan 02 '22
string is in the std namespace like cin and cout are. So you can either put using namespace std; on line 2. Or when you use string you prepend it with std:: (ie. std::string)
2
2
u/Luc_Studios Jan 03 '22
my man dont use notepad++
1
u/Gordon-III Jan 03 '22
This is how I remember doing it back in school. I have visual studio. What's the benefits of using the other?
2
u/Luc_Studios Jan 03 '22
Visual Studio for example has great IntelliSense, good code highlighting, a good debugger and much more.
There are other IDE's for C++ out there too but with Visual studio ur good to go.
Pretty much everything is better than Notepad++
3
10
u/[deleted] Jan 02 '22
C++ doesn’t know what string is, so you have to include it just like you included iostream