First name as end line, last name as head line.


must get first name in end line ,last name as head line. my solution like this. which i cannot get how the output sample should be.

cout<<""<<endl;
cout<<"Enter person 1's name :";
cin>> name;
getline(cin,name);

for (int i=0; i<number;i++)
{
cout<<"Enter the next person's name :" ;
getline(cin,name);
a[i]=value;
}

cout<< " " << name << " is at the head of the line \n";
cout<< " " <<name<< " is at the end of the line \n";

if (name<first)
{
first=name;
}

else if (name>last)
{
last=name;
}


return 0;


this out put supppose to look like this


Enter person 1's name: Julie
Enter the next person's name: Popo
Enter the next person's name: Helmi
Enter the next person's name: Henry
Enter the next person's name: Frodo

Frodo is at the head of the line.
Popo is at the end of the line.

Press any key to continue . . .
Topic archived. No new replies allowed.