
Untitled
By: a guest on
May 5th, 2012 | syntax:
None | size: 0.77 KB | hits: 12 | expires: Never
void SuperNuclearWar::FriendTurn()
{
int friendChoice = 0;
int friendRow = 0;
int friendColumn = 0;
bool friendDone = false;
while (!friendDone)
{
cout << "Which Row will you select? ";
cin >> friendRow;
if((friendRow > 0) && (friendRow <= m_height))
{
friendChoice += ((friendRow -1) * m_width);
friendDone = true;
}
else
{
cin.sync();
cin.clear();
cout << "Invalid selection";
}
friendDone = false;
}
while (!friendDone)
{
cout << "Which Column will you select? ";
cin >> friendColumn;
if((friendColumn >0) && (friendColumn <= m_height))
{
friendChoice += ((friendColumn -1) * m_height);
friendDone = true;
}
else
{
cin.sync();
cin.clear();
cout << "Invalid selection";
}
}
}