Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Functional Programming main #1

Open
PracticalPotato opened this issue Nov 18, 2015 · 1 comment
Open

Functional Programming main #1

PracticalPotato opened this issue Nov 18, 2015 · 1 comment

Comments

@PracticalPotato
Copy link
Collaborator

So, I've been working on cleaning up the main, and I've gotten to a point where I used functional programming, which bypasses the need to overload a function a billion times. The function replaces the loops that get and check input from cin.

Here's an example of a call to the function:
//check input username against data

getCheckedInput("Please enter your username.\n",
                user,
                INCLUDE, bind(&HashTable<User*>::inSet, Data, placeholders::_1), // Is user in the HashTable?
                "I'm sorry, that username is not found in our data banks. Please try again...\n\n");

As you can see, it's pretty readable except for the line I put a comment on (which will be different most of the time), but you wouldn't be able to write it unless you learn some programming or called me over to do it. Should I continue or go back to function overloading?

@WangWillis
Copy link
Owner

show us how to do it on thursday
and dont you still need to write the functions out for it though
but we'll see on thursday

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants