AnAriyan

Name string

Dec 18th, 2015
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.54 KB | None | 0 0
  1. #include<iostream>
  2. #include<string>
  3. using namespace std;
  4.  
  5. class string02{
  6.     private:
  7.        string fullName;
  8.     public:
  9.       void input(){
  10.          cout<< "Enter the Full Name : ";
  11.          getline(cin,fullName);
  12.       }
  13.       void processOutput(){
  14.         string fname=fullName.substr(fullName.rfind(" ")+1);
  15.         string lname=fullName.substr(0,fullName.rfind(" "));
  16.       cout<<"convert name : "<<fname<<", "<<lname<<endl;
  17.       }
  18. };
  19. int main(){
  20.    string02 obj;
  21.    obj.input();
  22.    obj.processOutput();
  23.    return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment