Objective![]()
|
LessonHardware & Software![]() The Personal Computer (PC) 1. Monitor 2. Motherboard 3. CPU (Microprocessor) 4. Main memory (RAM) 5. Expansion cards 6. Power supply unit 7. Optical disc drive 8. Hard disk drive (HDD) 9. Keyboard. 10. Mouse A computer's system unit, also commonly known as the computer case, contains a CPU (Central Processing Unit) while it usually has a monitor, keyboard, and a mouse connected to it. The CPU does all of the the processing and is an important part of the computer. Without it, the computer wouldn't even be able to run. The monitor displays graphics on a screen, which is easy for the user to see. The monitor acts as visual output. The keyboard and the mouse act as user input. The computer uses this input for many things and you'll most likely get some kind of response because of it. The computer uses all of this equipment to do its job. This equipment, called hardware, isn't the only thing that makes a computer run. With all of the hardware something else is still needed to bring the computer to life. The stuff that actually makes the computer do something is called software. Unlike hardware, software cannot be manipulated directly by the user. Usually, the user needs to use the computer to interact with the software. The CPU processes the software and executes it appropriately. Software is made up of a lot of instructions which the CPU executes. We don't need to go in depth about the instructions, since they vary between CPU's. The important thing is that we know that there are instructions. It is now understood that, if we want the computer to perform a task, we must first get the instructions first. How? We simply write them down and then turn them into executable code that the CPU can use. Just remember this, a computer program is a set of instructions (a "recipe") that defines the task to be performed. Program ExecutionMachine code is the computer's true language. Some would call it unreadable by human standards. However, it is digital poetry to the trained. Back when computer science was still in its infancy, all programs were written in machine language. Before screens and printers existed, the programmer laboriously entered into the computer the machine code for the program and then fed each instruction via some external device, such as punch cards or switches. This task of writing programs was extremely slow and prone to errors. When a program is executed, the computer reads each instruction and performs the task associated with that instruction. Since each computer can vary in the type and amount of instructions it has, we won't focus too much on this topic. The important thing to know is C's ability to be cross-platform when creating code. This portability was the key to C's success. CompilingMachine code is basically a set of instructions that the computer can execute. Computers use binary as the format for storing information. Each number can either be a 1 or a 0; which could be represented as on and off. Thankfully, a new method of writing programs has replaced machine code; this is called assembly. Although this is pretty consistent to writing binary, assembly still gives the program some edge, leading to less wasted time. Still, coding in assembly was slow and error prone. Higher-level programming languages started to appear. These made it easier for the programmer to write programs, efficiently and quickly. Some of these languages convert their code to assembly, which will come in handy later in the course. C, unlike a lot of new programming languages, converts its code to assembly where a new executable file is created. A Taste of CHere is the classic Hello World program written in C. #include <stdio.h>
int main(void)
{
printf("Hello, World!\n");
return 0;
}
Most, if not all, C programs have the In C, code is cut up into little blocks of code called functions. Unless declared otherwise, the function At the heart of our program is an instruction to write "Hello, World!" (followed by a newline character On the next line we have You may have noticed the semi-colon ( Try writing the source code above to a file. Save the file (remember to save it with the extension |
Assignments![]()
|