User Tools

Site Tools


c_-_c_strings:empty_member_function

C - C++ Strings - Empty Member Function

#include <iostream>
using std::cout;
using std::endl;
 
#include <string>
using std::string;
 
int main()
{
  string s1( "AA" );
  string s2( " AAB" );
  string s3;
 
  cout << "\n\nTesting s3.empty():" << endl;
 
  if ( s3.empty() )
  {
    cout << "s3 is empty; assigning s1 to s3;" << endl;
    s3 = s1;
    cout << "s3 is \"" << s3 << "\"";
  } 
 
  return 0;
}
c_-_c_strings/empty_member_function.txt · Last modified: 2020/07/15 09:30 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki