01: /****************************************************************************
02: ** COPYRIGHT (C):    1998 Cay S. Horstmann. All Rights Reserved.
03: ** PROJECT:          Computing Concepts with C++ 2E
04: ** FILE:             initials.cpp
05: ** NOTE TO STUDENTS: This file has been edited to be compatible with older
06: ** compilers. If your compiler fully supports the ANSI/ISO C++
07: ** standard, remove the line #include "ccc_ansi.cpp". You can also remove
08: ** the lines #ifndef CCC_ANSI_H and #endif
09: ****************************************************************************/
10: 
11:
12:
13: 
14: #include <iostream>
15: #include <string>
16: 
17: using namespace std;
18: 
19:
20: int main()
22: {  
23:    cout << "Please enter your full name (first middle last): ";
23:    string first;
24:    string middle;
25:    string last;
26:    cin >> first >> middle >> last;
27:
28:    string initials = first.substr(0, 1) 
29:                       + middle.substr(0, 1)
30:                      + last.substr(0, 1);
31:    cout << "Your initials are " << initials << "\n";
32: 
33:    return 0;
34: }