0% found this document useful (0 votes)
96 views

CSC430 Lab Assignment

This document contains details of a lab assignment for a C++ programming course. It includes the course code, date, lecturer, list of students, and tasks completed for Lab 1 which involve editing source code and writing pseudocode and flowcharts. Lab 2 involves tracing output and evaluating expressions. Lab 3 contains tasks to evaluate expressions and write assignment statements. Lab 4 involves selection structures. The tasks completed all coding runs successfully without errors detected.

Uploaded by

hey sooha
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
96 views

CSC430 Lab Assignment

This document contains details of a lab assignment for a C++ programming course. It includes the course code, date, lecturer, list of students, and tasks completed for Lab 1 which involve editing source code and writing pseudocode and flowcharts. Lab 2 involves tracing output and evaluating expressions. Lab 3 contains tasks to evaluate expressions and write assignment statements. Lab 4 involves selection structures. The tasks completed all coding runs successfully without errors detected.

Uploaded by

hey sooha
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 22

TITLE :

LAB ASSIGNMENT 1

CODE : CSC430
GROUP : EMD2M1C
DATE : 26 May 2023
LECTURER : Mdm Syeilla Eween

Student Name Student ID


QURRATUL NADJWA NURAISYAH 2022464476
BINTI NADZRI
MUHAMMAD ANIQ ABQARI BIN 2022464556
MOHD SALLEHSHAHIBBUDIN
IZZAIDA NURINA BINTI IZZAD 2022461386
SYAHIR NAJWAN BIN MOHAMMAD 2022496248
SUHAIMI
Lab 1 a) b) c)
Edit the following source code:

Task 1

Coding runs successfully, no error detected.

Task 2

Coding runs successfully, no error detected.


Task 3

Coding runs successfully, no error detected.

Task 4

Coding runs successfully, no error detected.


Lab 1 d)

PSEUDOCODE
TASK 1
BEGIN
1. Display "Hello, welcome to C++ programming!"
2. Display "Press any key to exit!"
3. SYSTEM CALL "pause"
END

TASK 2
BEGIN
1. Read no1, no2
2. Calculate the sum of the numbers using the formula. sum
= no1 + no2
3. Display sum
4. Display "Press any key to exit!"
END

TASK 3
BEGIN
1. Read no1, no2
2. If no1 bigger than no2
3. max = no1
4. else
5. max = no2
6. end if
7. Display max
8. Display "Press any key to exit!"

END

TASK 4
BEGIN
1. Set cnt to 0
2. Read no
3. If cnt is smaller than no
4. Display “Hello\n”
5. else
6. Display "Press any key to exit!"

END
FLOWCHART

Task 1

BEGIN

Display “Hello, welcome to


C++ programming!”

Display “Press any


key to exit!”

Pause

END
Task 2

BEGIN

Read no1, no2

Calculate the sum of the numbers using the formula sum = no1 + no2

Display sum

Display “Press any


key to exit!”

END
Task 3

BEGIN

Read no1, no2

False

no1 > no2

True

max = no1 max = no2

Display “Press any


key to exit!”

END
Task 4

BEGIN

Set cnt = 0

Read no

True
cnt < no

False

Display “Hello”
Display “Press any
key to exit!”

cnt = cnt + 1

END
Lab 2
1)

2)
3)

4)
Lab 3

Task 1
Trace the output of the following statement.

Int a=0 , b=1 ,


c=2; a--; b++; c--;
++a; --b; c--;
a--; b++; c--;
cout << a + 2 << endl;
cout << --b << endl;
cout << c-- << endl;

Task 2
Given the declaration below, find the results of each expression.

Int a=3 , b=10 , c=7;


Double w=12 , y=3.2;
Task 3
Given the declarations below, find the result of each expression.
a) z = x-n/m

b) b = x*y+m/n*2

c) i = int (x+0.5)
d) j = x*m-n%m

e) k = m/-n
Task 4
Write a C++ assignment statement for each of the following mathematics expressions.

a)

b)
c)

d)
e)

f)
g)
LAB 4
Selection Structure

a)
b)
c)
d)
Group Discussion

You might also like