0% found this document useful (0 votes)
97 views1 page

Assignment 3 QP PDF

The document provides instructions for 3 programming assignments in C++. Assignment 1 involves writing a program to perform a linear search on an array to find if a given number is present and its location. Assignment 2 is to read a 2D array, replace non-Armstrong numbers with their factorials, and display the original and modified arrays. Assignment 3 is to find all occurrences and positions of a substring within a main string. Additional questions involve rules for passing arrays to functions, writing a factorial function, operators for pass by reference, and a program to reverse names using functions.

Uploaded by

singh_saahil14
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
97 views1 page

Assignment 3 QP PDF

The document provides instructions for 3 programming assignments in C++. Assignment 1 involves writing a program to perform a linear search on an array to find if a given number is present and its location. Assignment 2 is to read a 2D array, replace non-Armstrong numbers with their factorials, and display the original and modified arrays. Assignment 3 is to find all occurrences and positions of a substring within a main string. Additional questions involve rules for passing arrays to functions, writing a factorial function, operators for pass by reference, and a program to reverse names using functions.

Uploaded by

singh_saahil14
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

ASSIGNMENT NO: 03

Subject: PROBLEM SOLVING USING COMPUTERS (CSE 1001)


DURATION: 30 Minutes

1. Write a C++ program using linear search to check whether the given number is part of a list of
numbers stored in the array along with location as per the following specifications. The program should
display the desired result and meaningful messages as under. (Proper input output 1 marks and
remaining code 3 marks(1.5 marks each for sorting &searching) )
a. Enter the Dimension:
b. Enter Values:
c. Input array:
d. Output array:
e. For searching the values should be in sorted order:
f. Sort in ascending Order using bubble sort method:
g. Print the values of array after sorting:
h. Enter the value to be searched:
i. Display the Value and its location in the list:

2. Write a c++ program to read a row x column integer elements to 2D array and replace non
Armstrong number by its factorial. Display the original array and the modified 2d array in matrix
format.

3. Write a c++ program to find the all occurrence of a sub string in a given main string with their
positions of occurrences.

4A. What are the rules of passing 1D array and 2D array to a function?

4B. Write a function fact ( ) to find the factorial of a given integer n. Use the above function fact ( )
to find the value of nCr for the given n and r [nCr=n! / (r!* (n - r)!)].

5A. List and explain the working of the two operators used to achieve parameter passing by
reference in C++.

5B. Write a C++ program using functions to reverse n names and display the reversed n names in
the main function.

You might also like