Anonymous user
Menu: Difference between revisions
m
→{{header|C++}}: formatting
m (→{{header|C++}}: formatting) |
|||
Line 98:
=={{header|C++}}==
<lang
#include <boost/regex.hpp>
#include <cstdlib>
#include <string>
using namespace std
void printMenu(
bool checkEntry(
void dataEntry(
void dataEntry
if (
cout << '\n'
return
}
printMenu
cout << "Enter a number from 1 to " << size << " :\n"
while ( ! ok ) {▼
bool ok =
cout << "Enter a number from 1 to " << size << " :\n" ;▼
cin >> entry;
ok = checkEntry(entry, terms, size);
}
}
void printMenu
for (
cout << i << ')' << terms[ i - 1 ] << '\n'
}
}
bool checkEntry(
boost::regex e
if (
return false
int number = atoi(
if (
return false
return true
}
int main( ) {
const string terms[ ] = { "fee fie" , "huff and puff" , "mirror mirror" , "tick tock" }
int size = sizeof terms / sizeof *terms
dataEntry(
return 0
}</lang>▼
▲</lang>
=={{header|Common Lisp}}==
|