Electrical and Computer Engineering
46 of 52
UAH
CPE 112
StringOps Program
•//****************************************************************
•// This program demonstrates several string operations
•//****************************************************************
•#include <iostream>
•#include <string>     // For string type
•using namespace std;
•int main()
•{
•    string fullName;
•    string name;
•    string::size_type startPos;
•    fullName = "Jonathan Alexander Peterson";
•    startPos = fullName.find("Peterson");
•    name = "Mr. " + fullName.substr(startPos, 8);
•    cout << name << endl;
•    return 0;
•}