#include#include using namespace std; int main() { string str = "Hello, world!"; if (str.empty()) { cout << "The string is empty" << endl; } else { cout << "The string is not empty" << endl; } return 0; }
The string is not empty
#include#include using namespace std; int main() { string str = ""; if (str.empty()) { cout << "The string is empty" << endl; } else { cout << "The string is not empty" << endl; } return 0; }
The string is emptyThe std::string empty function belongs to the C++ Standard Library (STL).