iam taking this class c++ in summer and is really giving me a lot of problems
here is tha hw question
write a program that reads a person's name int he folowing formaty:first name , then middle name or initial, and then last name. , ur program should work the same and place a period after the middle initial even if the input did not contais a period. your program shold allow for users who give no middle name. inthat case the output, of course, contains no middle name or initial.do one with string and the other one with c-strings.
and this is what i have so far
program compiles ok when there is a name , last and initial but when there is no middle initial, doesn't , how can i get the second string to do this, sould i use the function substr or the function find with a if statement??
using namespace std;
// Variable declarations
// strings read in
int ch; // character in input after second string
// Get the first two strings read in (first and middle names or
// first and last names)
cout << endl;
cout << "Please enter a Full name : ";
cin>> first >> second >> third;
record_name = third +"," + first + " " + second + ".";
cout << record_name <<endl;
cout <<"enter letter";
cin >> letter;
really confused now.....hehe any input will be apreciated!!