Edit: Most of the answers here are wonderful and spot on.
For those who interpreted it differently due to my incorrect and brief phrasing, by ‘teaching’ I meant how does the computer get to know what it has to do when we want it to perform arithmetic operations (upon seeing the operators)?
And how does it do it? Like how does it ‘add’ stuff the same way humans do and give results which make sense to us mathematically? What exactly is going on inside?
Thanks for all the helpful explanations on programming, switches, circuits, logic gates, and the links!
In: 583
You don’t. It’s sort of like asking “how do dominoes know how to fall and knock the next one down?”
Computers are just billions of little light switches (called transistors) that are set up like dominoes, with a handful of input switches that we can directly control. Turning on some switches causes some other switches to turn on, and others to turn off. By turning on curtain input switches and leaving others off, you’ll get a different output. Each unique input combination is an “instruction.” By using basic logic principles (look up “logic gates,” and “boolean logic,” if you want to learn more. It’s really pretty simple) we can set up these switches in a way so that we get the desired output.
Latest Answers