Você está na página 1de 2

www.VUSR.

net

Assignment No. 02 Total Marks: 20


Semester: FALL 2009
CS201: Introduction to Programming Due Date:16/11/2009

Instructions
Please read the following instructions carefully before submitting
assignment:
It should be clear that your assignment will not get any credit if:

§ The assignment is submitted after due date.


§ The submitted assignment does not open or file is corrupt.
§ All types of plagiarism are strictly prohibited.

Note: You have to upload only .cpp file. Assignment in any other format
(extension) will not be accepted. If you will submit code in .doc (Word
document) you will get zero marks.

Objective
SR
The objective of this assignment is to provide hands on experience of using

§ Basic concepts of C++ language and Programming


§ Conditional statements of C language
§ Arrays in c language
§ Char manipulation in c++
§ Sorting in c++
U
§ Merging arrays

Guidelines
§ Code should be properly aligned and well commented.
V

§ Follow c/c++ rules while writing variables names, function names etc
§ Use only dev-C++ for this assignment.
§ Use appropriate c/c++ structure i.e. loop, if-else, switch statement
etc to get inputs from user (Marks will be deducted if inappropriate
structure will be used).

Assignment

Problem Statement: Merging and Sorting of character arrays


You are required to write a program that takes character values in two
different arrays as input from user. After getting input, make a third
array and merge both these array in third array. Output array must be
sorted in ascending order.

http://lms.vusr.net All VU Past Study Resource


www.VUSR.net

Detailed Description:

1. Declare three character type arrays.


2. Use two arrays to take input from user.
o Take input as char type.
o Take 10 values in each array.

3. Merge both these input arrays.


o If an input character is in both arrays, then it should appear
once in resulted array.
4. Store result in third array.
5. Sort resulted array in ascending order.
o Ascending order means string values starting from ‘a’ will come
first, and then starting from ‘b’ and so on.
6. Display them after sorting

Sample Output
SR
Enter values in first array: a h b c u v I j k e
Enter values in Second array: y u d f g k I w q a

Merged array: a y h u b d c f g v k I j w q e
U
Sorted Array in ascending order: a b c d e f g h I j k q u v w y

Deadline
V

Your assignment must be uploaded/submitted on or before November 16, 2009

http://lms.vusr.net All VU Past Study Resource

Você também pode gostar