-
array ???????
Hi,
the Q is program should be able to handle mulitple names of a competitor ,if there are mulitple names display it and ask ID for which record changes have to be made. But if the user doesnt want to makes changes he just presses enter key ..(so the previous contents from the database are stored.
I can search duplicate names ,display them ,display the record with particular ID BUT
My PROBLEM is I dont know how to preserve the contents if user presess enter key......
Pls help me out.......
Thanks a lot.......
my code relevant to problem:
Code:
findRecord(database, tmprec, findArray, totalSelected);
displayFindRecord(database, findArray, tmprec, totalSelected);
compName = getEditCompetitorName();
if (!compName.empty())
{
validCompName = validateCompetitorName(compName);
}
compGender = getCompetitorGender();
if(!compGender.empty())
{
while(!validGenderFormat(compGender))
{
cout << "\nError : Invalid gender format, please retry...";
compGender = getCompetitorGender();
}
}
:
:
}
-
I think I know what your asking. The answer is to place your code that changes the data inside an if statement like so:
Code:
if(cin.get(compName, numofcharacters)){
//your code here
}
if cin.get reads a blank line it will return false thus bypassing your code which changes the data. (Note change numofcharacters to the amount you wish to read.) Also in order to input again you will have to place cin.clear(); prior to your next input.