Concepts:
Nested Loops, functions, strings & Arrays
Objective: to revision Nested Loops, functions, strings & Arrays concepts
and get familiar with them.
Background: Student should have concepts of Nested Loops, functions, strings
& Arrays.
Pre-Lab: Students
should have implemented all lab-related these concepts.
Assessment tools:
The assessment is according to the student participation in the
lab if the student solves the exercise, he will get the participation mark for
this lab.
Assignment Tasks:
Task 1:
Write a program that
inputs the height of triangle and displays a triangle of characters. For
example, if the user enters 5 it displays the following:
Enter the height of
the triangle:
A
B C
D E F
G H I J
K L M N O
P Q R S
T U V
W X
Y
Task 2:
Write a program in
C++ to use String data type and its build-in functions such as:
·
strcpy (
)
·
strncpy
( )
·
strlen (
)
·
strcmp (
)
Please create one
program which use all these functions on the String variables.
Task 3:
Write a program in
C++ to take input in string variable such as name, house address, cnic,
university’s name and print on the console.
Task 4:
Write a program to print the following triangle patterns on
console
Task 5:
Write
a program to print all prime numbers between the range taken from the user.
(Ask the user to enter starting and ending numbers).
Task 6:
Write
a program to take input in integer Array and print all the value on the console
using Functions.
Task 7:
Write a program in C++ to calculate the volume
of a cube using function.
Sample
Output:
Calculate
the volume of a cube:
---------------------------------------
Input
the side of a cube: 5 The volume of a cube is: 125
Task 8:
write
a program in C++ to calculate the value of 2X^2+bx+c by using functions. Your
function should compute the equation and then return the value to the main
function?
Task 9 (Bonus):
Write a program to implement student record management
system in which you ae instructed to create multiple functions such as:
·
Menu () this function will ask the user
for input for example:
§
Press 1 for add record such as name, sap#,
section, gender
§
Press 2 for search for the records
§
Press 3 for update the record of the student
§
Press 4 for exit
·
addRecord(string name, int sap#, char
dection, char gender)
Ø
this function will take the input form the user.
·
Search_Record( int sap)
Ø
This function will use to search for the record
prints all information if user exist or prints no user fount otherwise.
·
Update_Records(int sap)
this function will use to update the
record of the students if found and user can update name, sap#, or anything of
his/her choice.
You
are needed to implement this system for at least 10 students.
Post a Comment