#include#include int main() { std::string str = "Hello"; std::cout << "Original string: " << str << std::endl; str.pop_back(); std::cout << "String after using pop_back(): " << str << std::endl; return 0; }
Original string: Hello String after using pop_back(): Hell
#include#include int main() { std::string str = "Hello"; std::cout << "Original string: " << str << std::endl; str.pop_back(); str.pop_back(); std::cout << "String after using pop_back() twice: " << str << std::endl; return 0; }
Original string: Hello String after using pop_back() twice: HePackage library: The C++ string pop_back() function is part of the standard C++ library, so it is not contained within any specific package or library.