#include <string> using namespace std; int main() { string a = "I am learning C++"; return 0; } why it has no op? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

#include <string> using namespace std; int main() { string a = "I am learning C++"; return 0; } why it has no op?

?

27th Feb 2019, 4:04 AM
KALYAN THAKUR
KALYAN THAKUR - avatar
2 Answers
+ 9
You declared a string, but did not output the string. In C++, you'll need the <iostream> header to handle IO. #include <iostream> Try printing the string after declaring and initializing it. string a = "I am learning C++"; cout << a;
27th Feb 2019, 4:43 AM
Hatsy Rei
Hatsy Rei - avatar
0
Thanks
21st Mar 2019, 6:07 PM
KALYAN THAKUR
KALYAN THAKUR - avatar