#include#include using namespace std; int main() { string str = "hello"; if(str.empty()) { cout << "String is empty" << endl; } else { cout << "String is not empty" << endl; } return 0; } Output: String is not empty
#includeThese examples illustrate the functionality of the cpp std basic_string empty function. The library for this function is part of the standard C++ library.#include using namespace std; int main() { string str = ""; if(str.empty()) { cout << "String is empty" << endl; } else { cout << "String is not empty" << endl; } return 0; } Output: String is empty