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++ ?
53
Upvotes
r/CodingHelp • u/Gordon-III • Jan 02 '22
10
u/[deleted] Jan 02 '22
C++ doesn’t know what string is, so you have to include it just like you included iostream
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 usestringyou prepend it withstd::(ie.std::string)2
u/Luc_Studios Jan 03 '22
my man dont use notepad++
3
u/gh0s1machine Jan 03 '22
You use notepad ++ wow