Hi all, I'm completly useless at C++ and was wondering if anyone can tell me how to tell a program that when I have pressed Enter, if the string is empty do nothing.
Its for updating details. I'm using an Input header file that my lecturer wrote.
This works fine for updating a student number.
//Amend Student Number
cout << "Change Student Number From [" << oldrecord.stuno << "] to: ";
Input(tmprecord.stuno);
if ( tmprecord.stuno == 0 ) // if return pressed only
newrecord.stuno = oldrecord.stuno;
else
newrecord.stuno = tmprecord.stuno;
But i am not sure how to do it for a string
//Amend First Name
cout << "Change Student First Name From [" << LEFT(21) << oldrecord.firstname.Out << "] to: ";
Input(tmprecord.firstname,21);
if ( tmprecord.firstname,21 == LEFT(1) << " " ) // if return pressed only
newrecord.firstname = oldrecord.firstname;
else
newrecord.firstname = tmprecord.firstname;
I know that LEFT(1) << " " doesn't work. Using == 0 the program works but the fields are empty after updating.
Thanks