You are on page 1of 2

CS 101 Computing & AI

Assignment 06

Date of Announcement: 25-12-2022 Submission Deadline: 28-12-2022 Mid Night (11:59 PM)

Instructions
● You are required to submit a separate C++ file for each Question.
● Each file should be named with the Question Number e.g. question_09.cpp. You
should zip all your questions in one file.
● Make sure your code is compiling before submission, if the code does not compile for a
particular question it will be graded 0.
● Each variable in your code should be modified with the last 3 digits of your registration
number as well as the first 3 alphabets of your name.
○ E.g. Student name: Ali, Registration u2022012
○ Each variable in the code should look like this: int ali_num1_012;
○ Another example for naming the variable num2, and salary of int data type
■ int ali_num2_012, ali_salary_012;
● Late submissions will receive -25% for each day. Hence, after 4 days your assignment
will receive 0 marks.
● Cheating will not be tolerated. All identical assignments will be graded 0.

Question 01
Write a program to swap two numbers using pointers.

Question 02
Write a program to find out the greatest and the smallest among three numbers using pointers.

Question 03
Write a recursive function which prints all the numbers in the array which are less than the
number provided by the user.
1) Print the numbers in the given order.
2) Print the numbers in reverse order.

Question 04
Write a function that takes an array of integers and its size as arguments and returns the sum of
the elements of the array. Use a pointer to traverse the array and calculate the sum.

Question 05
Write a function which takes the values from the user,
● length of the array
● lower bound of the values
● upper bound of the values.
Then ask the user to input the values in the array, if a value out of bounds is entered it should
not be stored in the array. At each input user should be told how much space is available in the
array and how many items are currently in the array. If the array is full, it should be printed.

You might also like