Use the cin operator to retrieve data from the keyboard.
#include <iostream> using namespace std; int main()//from w ww. ja v a 2 s. com { char first[20]; // Holds the first name char last[20]; // Holds the last name cout << "What is your first name? \n"; cin >> first; cout << "What is your last name? \n"; cin >> last; // Print the initials cout << "Your initials are " << first[0] << " " << last[0]; return 0; }