Advertisement
Guest User

Untitled

a guest
Nov 21st, 2014
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. int validateStringInput(std::string input, std::string validInput[], std::string errorMsg)
  2.     {
  3.         int inputIndex = 0;
  4.        
  5.         std::cin.ignore();
  6.         getline(std::cin, input);
  7.         bool inputb = true;
  8.         input = changeStringToLower(input);
  9.         while(inputb)
  10.         {
  11.             for (std::string s : validInput)
  12.             {
  13.                 if (s.compare(input) == 0)
  14.                 {
  15.                     inputb = false;
  16.                     break;
  17.                 }
  18.                 else if (inputIndex == 4)
  19.                 {
  20.                     printSpace(errorMsg);
  21.                 }
  22.                 inputIndex++;
  23.             }
  24.         }
  25.        
  26.         return inputIndex;
  27.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement