ALGORITHMS AND PROGRAMMING LANGUAGES (CENP2202)
Electrical and Electronic Engineering - EEE
Semester: Second Semester
Level: 200
Year: 2017
REPUBLIC OF CAMEROON THE UNIVERSITY OF BAMENDA
Peace-Work-Fatherland P.O Box 39 Bambili
First Semester Examination
School: COLTECH Department: Electrical and Power Engineering Option: ALL
Course Code: Course Title: C++ Programming Credit Value:
Lecturer: Mbiethieu Cezar Credit Value
Date: Time: 2h Start Time: End Time:
Exercise 1: Considering the following algorithm,
1. Convert it into a C++ program, knowing that the write_char() is a function that displays the
character/letter corresponding to the ASCII code given as parameter. Eg. Write_char(65) displays A.
2. Execute the program and display the result.
Exercise 2: (20marks) Given the following function f(n) =
0 =0
1 =1
− 1
+
− 2
>1
Write a C++ program to solve the given problem.
Exercise 3: (10marks)
Write a C++ program that reads N numbers and counts the number of positive numbers then print the
average of all positive values.
Exercise 4: (25 marks)
Given an array of integers A of size MxN,
a- write a C++ function to display the elements of A column by column; Example if
A=
00 01 02
10 11 12
20 21 22
then your program displays: a00, a10, a20; a01, a11, a21; a02; a12,
a22;
b. Write a C++ function that multiplies the elements of the last column of A by a number X given as
function parameter.
www.schoolfaqs.net