Throw stuff at me!

Pages: 12
I think there's still a severe misunderstanding here. The algorithm would be in a library, you're just calling different functions with different parameters.
What? We're not talking about a library, were talking about this:





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.
Algorithm-a process or set of rules to be followed in calculations or other problem-solving operations


You going to download hundreds of libraries to finish your program(s)?


http://en.wikipedia.org/wiki/Algorithm
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]

Look up "logic gates." Trust me, it doesn't take hundreds of libraries to deal with algorithms. A calculator adds by using an xor and an and gate. Logic gates can be found in the math.h library.
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.

@RealGigantis

1
2
3
if ( ! ! ! ! ! ! ! ! ! ! 1 )
    std::cout << ! ! ! ! ! ! ! ! ! ! ! ! !  ! ! 1  << std::endl;
}   


If you want to look up a good algorithm that isn't standard in C++, check out union find.

For game development, I think you need to be more specific to get good answers.
Last edited on
htirwin wrote:
efficiency will hardly matter
missatributed_to_Bill_Gates wrote:
640K ought to be enough for anybody.
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:

xor cipher

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <conio.h>
#include <math.h>
#include <cstdlib>
#include <iostream>

int main{
int key;
int x;
cin>> key;
a:
x=getkey();
cout<< x xor key;
cout<< "\n";
goto a;


Don't try to compile this because I didn't check it for errors and I'm tired...
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.

Edit:
http://ideone.com/7Hyqpt
http://ideone.com/x1jfuZ
Don't try to repeat it, Ideone updated their compiler.
Last edited on
I want to see some z80 assembly
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.
Topic archived. No new replies allowed.
Pages: 12