Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 5th, 2012  |  syntax: None  |  size: 0.77 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. void SuperNuclearWar::FriendTurn()
  2. {
  3.         int friendChoice = 0;
  4.         int friendRow = 0;
  5.         int friendColumn = 0;
  6.         bool friendDone = false;
  7.  
  8.         while (!friendDone)
  9.         {
  10.                 cout << "Which Row will you select? ";
  11.                 cin >> friendRow;
  12.                 if((friendRow > 0) && (friendRow <= m_height))
  13.                 {
  14.                         friendChoice += ((friendRow -1) * m_width);
  15.                         friendDone = true;
  16.                 }
  17.                 else
  18.                 {
  19.                         cin.sync();
  20.                         cin.clear();
  21.                         cout << "Invalid selection";
  22.                 }
  23.                 friendDone = false;
  24.         }
  25.         while (!friendDone)
  26.         {
  27.                 cout << "Which Column will you select? ";
  28.                 cin >> friendColumn;
  29.                 if((friendColumn >0) && (friendColumn <= m_height))
  30.                 {
  31.                         friendChoice += ((friendColumn -1) * m_height);
  32.                         friendDone = true;
  33.                 }
  34.                 else
  35.                 {
  36.                         cin.sync();
  37.                         cin.clear();
  38.                         cout << "Invalid selection";
  39.                 }
  40. }
  41. }