My Assignment said:
Write a C++ program that will allow for input of two full names in this format: Lastname, Firstname. It must print the names and state which name comes before the other alphabetically. For a test run, you may input two names of your choice.
Here's what I have so far:
#include <iostream.h>
#include <conio.h>
void main();
{ int firstname, lastname, first, second, numInput;
cout << "Please enter how many names you'd like to input: ";
cin >> numInput;
cout << endl << endl;
cout << "Enter the name(s) in the following format [LASTNAME, FIRSTNAME]";
cout << endl << endl;
for(int x; x <= numInput; x++)
{ cout << "Please enter the name: ";
cout << "Lastname... ";
cin >> lastname;
cout << endl;
cout << "Firstname...";
cin >> firstname;
cout << endl;
}
What I need help with is, how do I add the code segment where it will find the ASCII value of the first letter of the lastname, and then tell it which of the names comes first...


Sign In
Create Account


Back to top









