I am coming from Java and I’m new to C++. I’m trying to declare a String:
#include <iostream>
using namespace std;
int main()
{
String str = "ABC";
cout << str << '\n';
}
but it gives an error:
error: 'String' was not declared in this scope
17 | String str = "ABC";
Why is this happening?
>Solution :
"String" should be lowercase.
You will also need to import the string library, which is done by
#include <string>