+ 1

Hi guyss!! Need a bit of help

I have started C++ and doing pretty well{ I mean I think so } and I want to make a calculator. For that I want to declare a variable as a string llike we declare integer if any one of you know this please do tell me.

25th Oct 2022, 2:37 PM
Saswat Sahu 8432
Saswat Sahu 8432 - avatar
2 Respuestas
0
#include <string> using namespace std; //can be declared with or without a value string stringName = "value";
25th Oct 2022, 3:01 PM
Christian Daumal
Christian Daumal - avatar
0
In c++, you need to include string library using #include <string> for more features on strings. After including library you can declare string variable as follows - string var; var = "hello"; Above lines will declare string variable var and set its value to "hello". You can do same thing in one line as - string var = "hello";
25th Oct 2022, 3:03 PM
Vijay Meena