al·go·rithm
ˈalgəˌriT͟Həm/Submit
noun
noun: algorithm; plural noun: algorithms
1.
a process or set of rules to be followed in calculations or other problem-solving operations, esp. by a computer.
"a basic algorithm for division"
Origin

late 17th cent.: variant (influenced by Greek arithmos ‘number’) of Middle English algorism, via Old French from medieval Latin algorismus . The Arabic source, al-Ḵwārizmī ‘the man of Ḵwārizm’ (now Khiva), was a name given to the 9th-cent. mathematician Abū Ja῾far Muhammad ibn Mūsa.

In mathematics and computer science, an algorithm (Listeni/ˈælɡərɪðəm/ al-gə-ri-dhəm) is a step-by-step procedure for calculations. Algorithms are used for calculation, data processing, and automated reasoning.
An algorithm is an effective method expressed as a finite list[1] of well-defined instructions[2] for calculating a function.[3] Starting from an initial state and initial input (perhaps empty),[4] the instructions describe a computation that, when executed, proceeds through a finite[5] number of well-defined successive states, eventually producing "output"[6] and terminating at a final ending state. The transition from one state to the next is not necessarily deterministic; some algorithms, known as randomized algorithms, incorporate random input.[7]

I posted it the same time you posted yours I was not quoting you. I was quoting google and responding to LB about using several libraries to get the desired algorithms.

Yes I know what a logic gate is we were taught them in circuit analysis at the university here. Though I am not sure what you mean here Logic gates can be found in the math.h library anyways you should be using cmath for c++.

I'm not trying to discount what LB said; he has a point; whenever you can benefit from using the STL or anything standard provided to you, you should. Especially at the beginner stage this is important to learn. This means understanding the algorithms behind the different data structures offered to you and the time and space complexities / advantages. This is really fundamental, and if nothing else, you should know these things.

But technically every piece of logic that describes a process is an algorithm. Programs are chock full of them. When the choice of algorithm will have a real impact on the performance of your program, if possible, you should always do your research and find the best choice of existing algorithm.

For me it is boring. I like to reinvent the wheel always. I am quick and successful as a programmer, but I find when it comes to serious algorithmic challenges, my quick and dirty solutions are dwarfed by those who have solved the same problems before me.

Games development is particularly fun because you have a chance to think of some creative behavior or challenge that hasn't been yet created exactly the same way.

Doing real research in algorithms I think is tough because it is difficult to improve upon what already exists. But it seams that there is a lot of room still to develop parallel versions of existing algorithms, or new algorithms that can exploit massive parallelism.

One day of course they will master quantum computing and efficiency will hardly matter; your passwords will need to be 1000 characters long and performance for anything else but cracking codes and encrypting codes will be moot.

Uuh, math.h is a different way of writing cmath. Try it in you're compiler. You can type both and the c standard math library will still be included. What I mean by it's in the library is that you can use the function of logic gates because their operation is included in the cmath library. Example:

math.h is an outdated header. Compilers do have it as a compatibility with C, but it is not supported anymore. That means that bugs will less likely to be fixed and new C++11 features are not included in that version. Same for other .h headers.

I have seen cmath and math.h functions behaving differently on some compiler versions. Will try to find link.

You do realize xor is the operator ^ and you do not need to include any libraries to use it right? http://www.cplusplus.com/doc/tutorial/operators/ towards the bottom. It looks like you are coming from c because your code is like half c and half c++. Instead of using a goto (should be avoided most cases) you should use a while/do while loop.