CS201 - Introduction to Programming Assignment No. 1 Solution Fall 2018 Due Date: December 05, 2018 

Assignment No.  1
Semester: Fall 2018

CS201 – Introduction to Programming

 

Total Marks: 20

Due Date:

05-December-2018

 

 

Instructions

Please read the following instructions carefully before submitting assignment:

It should be clear that your assignment will not get any credit if:

 

  • Assignment is submitted after due date.
  • Submitted assignment does not open or file is corrupt.
  • Assignment is copied (From internet/students).

 

Software allowed to develop Assignment

 

  • Dev C++

 

Objectives:

To enable students to write, compile and execute a program in Dev C++. Moreover to familiarize students with  the concepts of:

 

  • Loops
  • Switch, break, continue
  • Functions
  • Arrays
  • Pointers

 

Assignment Submission Instructions

You have to submit only.cpp file on the Assignments interface of CS201 at VULMS. Assignment submitted in any other format will not be accepted and will be graded zero marks.

 

Assignment

 

 

Write a program which defines three functions:

  • genRandNum()
  • findMinNum()
  • swapValue()

 

genRandNum(): This function will generate 5 random numbers in range 1-100 and store these numbers in array and print array on console.

 

Now start sorting these numbers in ascending order (lower to higher) by following the given steps:

1.      findMinNum(): This function will search smallest number in unsorted part of array.

2.      If leftmost number is the smallest number in unsorted array then no need to swap it otherwise swap the smallest number with left most unsorted number using swapValue() function. Now this number is fully sorted.

3.      Repeat the above 2 steps until the whole array get sorted.

Now display the sorted array as given in the screenshot.

 

Note: Use srand() with rand() library function to generate unique random numbers each time we run the program because rand() function will generate same number each time.

 

Deadline:

The deadline to submit your assignment solution is 05-December-2018. Your assignment must be submitted within the due date through VULMS. No assignment will be accepted through email after the due date.

 

Tags: -, 05, 1, 2018, Assignment, CS201, Date:, December, Due, Fall, More…Introduction, No., Programming, Solution, to

Views: 591

Attachments:

SPONSORED LINKS

SPONSORED LINKS

© 2018   Created by Irfan Khan MSCS.   Powered by

Badges  |  Report an Issue  |  Terms of Service