Professional Documents
Culture Documents
Exercise 3
Learning Outcomes
After completing this lab, you will be able to: o describe the steps in
the programming process o know how to edit a program o know
how to compile and run a program
A. LAB ACTIVITIES
Question 1
List the five basic steps in the programming process.
Answer 1. Defining the problem 2. Planning the solution 3. Coding the program 4.
Testing the program 5. Documenting the program
Question 2
Define an algorithm.
Answer A precise step-by step action to perform overall task of the program
Question 3
Define a flowchart.
Question 4
Define a pseudocode.
Question 5
What is the purpose of documentation inside a program?
1
CSC425 INTRODUCTION TO COMPUTER PROGRAMMING
Answer The presence of documentation helps keep track of all aspects of an application
and it improves on the quality of a software product.
Question 6
What is the symbol used to represent input/output in a flowchart?
Answer Parallelogram
Question 7
Ammar lives in Shah Alam that charges 3% income tax on yearly wages. He wants you
to write a program that will display the income tax. Identify the input, process and output
of this problem.
Answer
Input: scan the yearly wages
Process: calculate yearly wages*0.03=income tax
Output: Display the income tax
Question 8
Edit your program according to the following program statements. Save your program
as lab1_prog3.cpp.
Program 1.3
a. Compile the program. If error messages appear, write down all the errors.
‘cout’ was not declared in this scope
‘endl’ was not declared in this scope
b. Check your program carefully. Compile and run the program again until no
errors appear. What is the program output?
2
CSC425 INTRODUCTION TO COMPUTER PROGRAMMING
Question 9
Edit Program 1.3 by changing Hello and world to your name and student ID, save
your program as lab1_prog4.cpp. Compile and run after the modification.
3
CSC425 INTRODUCTION TO COMPUTER PROGRAMMING
Question 10
int main()
{
cout << (14 + 4 – 8 / 2) << endl;
return 0;
}
Program 1.4
Question 11
4
CSC425 INTRODUCTION TO COMPUTER PROGRAMMING
int main()
{
cout << “5 + 2 = ” << (5 + 2) << endl;
return 0;
}
Program 1.6
5
B. POST-LAB ACTIVITIES
Question 1
* * * * * * * * * * * * * *
* * * * *
* Thank You *
* Please come again.
* * * * * * * * * * * *
* * * * * *
Question 2
Question 3
Write a program to display your own message. Your message must be at least five lines.
7