Programming Fundamentals
Programming Fundamentals
PROGRAMMING FUNDAMENTALS
Assignment # 1
Foundations of Programming: Core Concepts in Computer Systems
and C++ Development
DECEMBER 4, 2023
2
Question # 1
Explain the fundamental components of a computer system, emphasizing the roles of
input/output devices, the CPU, and memory. Discuss how these components collaborate to
execute computer programs.
Answer # 1
Computer:
A computer device is composed of five
basic components that work together to
facilitate data processing. These components
include the central processing unit (CPU),
memory, storage, input devices, and output
devices. Each of these elements plays a crucial
role in the overall functioning and efficiency of
the computer. By working together, they make
the processing of data easier and more
convenient for users.
Components of Computer:
Components of a computer system are the primary elements which make the functioning
of an electronic device smooth and faster. There are five basic components which include:
1. CPU
2. Input devices
3. Output devices
4. Motherboard
5. Memory
3
Question # 2
Explore the components of a C++ development environment, such as the editor, preprocessor,
compiler, linker, loader, and CPU. Explain the role of each component in the process of writing,
compiling, and executing a C++ program. Provide an introduction to the
Dev C++ environment.
Answer # 2
A C++ development environment consists of several components that play a crucial role in the
process of writing, compiling, and executing a C++ program. Different important tools are as
follows:
Editor:
The editor is a tool used for writing and editing C++ code. It provides features such as syntax
highlighting, code completion, and debugging tools to help you develop your code.
Preprocessor:
The preprocessor is a program that processes the C++ code before it is passed to the compiler. It
handles directives such as #include and #define, and performs tasks such as including header files and
macro expansion.
Compiler:
The compiler is a program that translates the C++ code into machine code that can be executed by
the CPU. It checks for syntax errors and generates object files from the source code.
Linker:
The linker is a program that takes the object files generated by the compiler and combines them with
any necessary libraries to create an executable program. It resolves external references and generates
the final executable file
Loader:
The loader is a program that is responsible for loading the executable program into memory for
execution. It performs tasks such as memory allocation and linking of dynamic libraries.
CPU:
The CPU (Central Processing Unit) is the hardware component that executes the machine code
generated by the compiler. It interprets the instructions and performs the computations specified in the
C++ program.
5
Dev-C++ is a popular integrated development environment (IDE) used for C and C++
programming. It is free and comes with features like a code editor, debugger, project manager,
compiler, and linker. Its cross-platform compatibility and user-friendly interface have made it
the preferred choice for many developers.
Question # 3
Explore Design a flowchart and provide pseudocode for a program that takes a user-input dollar
amount, converts it to its equivalent in rupees using the exchange rate of 280 rupees per dollar,
and then displays the resulting rupees amount.
6
Answer # 3
To create a program that takes a user-input dollar amount, converts it to its equivalent in
rupees using the exchange rate of 280 rupees per dollar, and then it displays the resulting
amount in rupees, a flowchart and pseudocode can be designed as follows:
Flow Chart:
Start
End