1 - Components of A Computer
1 - Components of A Computer
G.R.K.Gupta
COMPONENTS OF A
COMPUTER
A computer is a complex system made up of various
interconnected components, each serving a specific function.
These components work together to perform tasks and process
data. Here are the key components of a typical computer:
Central Processing Unit (CPU)
The data that the input unit accepts goes to the processing unit
before execution. This unit understands what the command
actually is and how they can achieve it. It converts data
accepted in human language into machine language for
computers to understand. It has a mainboard with a central chip
which is the primary part of the processor.
The system doesn’t respond unless it receives a command from the user using
the input unit or the input devices. The users use numbers, letters, images, etc.
to enter the command, the input devices are the ones accepting them. For
example – we use a keyboard to enter a text, the keyboard here becomes the
input unit.
Functions of Input Unit of a Computer System
•Takes in user commands in the form of data.
•Converts data in a digital language format.
•Sends over the data to the processing unit for the next step.
31
Personal Computing, Distributed Computing,
and Client/Server Computing
• Personal computers
• Economical enough for individual
• Distributed computing
• Computing distributed over networks
• Client/server computing
• Sharing of information across computer networks between file servers and
clients (personal computers)
32
Machine Languages, Assembly Languages,
and High-level Languages
Three types of programming languages
1. Machine languages
• Strings of numbers giving machine specific instructions
• Example:
+1300042774
+1400593419
+1200274027
2. Assembly languages
• English-like abbreviations representing elementary computer operations (translated via
assemblers)
• Example:
LOAD BASEPAY
ADD OVERPAY
STORE GROSSPAY
33
Machine Languages, Assembly Languages,
and High-level Languages
Three types of programming languages (continued)
3. High-level languages
• Codes similar to everyday English
• Use mathematical notations (translated via compilers)
• Example:
grossPay = basePay + overTimePay
34
History of C
•C
• Evolved by Ritchie from two previous programming languages, BCPL and B
• Used to develop UNIX
• Used to write modern operating systems
• Hardware independent (portable)
• By late 1970's C had evolved to "Traditional C"
• Standardization
• Many slight variations of C existed, and were incompatible
• Committee formed to create a "unambiguous, machine-independent"
definition
• Standard created in 1989, updated in 1999
35
The C++ Standard Library
• C++ programs consist of pieces/modules called functions
• A programmer can create his own functions
• Advantage: the programmer knows exactly how it works
• Disadvantage: time consuming
• Programmers will often use the C++ library functions
• Use these as building blocks
• Avoid re-inventing the wheel
• If a premade function exists, generally best to use it rather than write your own
• Library functions carefully written, efficient, and portable
36
Other High-level Languages
• Other high-level languages
• FORTRAN
• Used for scientific and engineering applications
• COBOL
• Used to manipulate large amounts of data
• Pascal
• Intended for academic use
37
1.13 Structured Programming
• Structured programming
• Disciplined approach to writing programs
• Clear, easy to test and debug and easy to modify
• Multitasking
• Specifying that many activities run in parallel
38
Code for getting Table of a given number
#include <iostream>
int main()
{
using namespace std;
int num, limit;
// Get the number from the user
cout << "Enter a number: ";
cin >> num;
// Get the limit for the multiplication table
cout << "Enter the limit for the table: ";
cin >> limit;
// Print the multiplication table
cout << "Multiplication table for " << num << " up to " << limit << ":\n";
for (int i = 1; i <= limit; ++i)
{
cout << num << " x " << i << " = " << num * i << "\n";
}
return 0;
}
Hello world code
#include<iostream>
using namespace std;
int main()
{
}
#include <iostream>
int main()
{
using namespace std;
int num, limit;
// Get the number from the user
cout << "Enter a number: ";
cin >> num;
// Get the limit for the multiplication table
cout << "Enter the limit for the table: ";
cin >> limit;
// Print the multiplication table
cout << "Multiplication table for " << num << " up to " << limit << ":\n";
for (int i = 1; i <= limit; ++i)
{
cout << num << " x " << i << " = " << num * i << "\n";
}
return 0;