Sie sind auf Seite 1von 3

[EE-262 PROGRAMMING WITH C LANGUAGE]

Instructions:
1) The assignment needs to be completed individually. Collaboration with other
students is not allowed however sharing of ideas is acceptable here ideas
strictly mean ideas and not codes. You also need to provide reference of person
with whom you have shared ideas.
2) The theme of this assignment is DIY (Do It Yourselves), however you can take help
from books, internet, discussion forums etc on one condition only; provide
complete and proper reference at every point where you have used these
resources.
3) Method of referencing:
Put an asterisk [ * ] at the point of reference in the program and at the foot of the
same page provide the reference starting with the asterisk [ * ]. For a second or
third reference use two or three asterisks respectively [ ** , *** ].
The reference at the foot should be complete like:
*www.cprogramming.com/steve_summit/q%27_35%20.htm
**Introduction to C Programming by Paul Wolfowitz, Page 39-40
***Idea taken form Muhammad Ahmed, TE(Electronic), Section A, Roll No.: EL-133
4) The assignment needs to be submitted online. Method of submission is to put all
your c/cpp files inside a folder finally compressing it as .zip or .rar which needs to
be sent. This zip/rar folder should be named in exactly the following way:
rollNo_name_section.zip/rar
Examples : EE112_zubair_B,
characters are allowed].

EE4_ahmed_C [Note: No spaces or special

Non-compliance in following this method shall lead to rejection of your


assignment. The email should be sent to your respective theory teachers
Mr.IqbalAzeem (iqbal.azeem@neduet.edu.pk) and Mr. Muhammad Hassan ulHaq
(muhammad_hassanulhaq@yahoo.com).
5) Programs made for each question should be tested on the compiler. If any of them
are not running satisfactorily by the end of deadline, do mention it in comments.
6) Answers should be saved in files with proper names like question1.cpp,
question2.cpp etc.
7) Sessional marks for this assignment are 08equally divided among all questions.
8) If you are using any technique/function/library not covered in the course to solve
the problems, provide brief documentation and reference for them in comments.
9) Non-compliance with any of these instructions shall lead to deduction of marks.
10) Assignment submission deadline: 27-10-2014
REMEMBER: Assignments shall be compared for similarities and checked for
plagiarism. Remember the rule of prudence: Copying is a Crime punishable by
deduction of marks.

Question 1:
Improve the binary search program made in class so that it can search out
multiple entries of the same search value.
Question 2:
Make the Student Poll Program, Fig. 6.7, Page 203 on compiler from your
textbook and give description in 30 lines.

[EE-262 PROGRAMMING WITH C LANGUAGE]


Question 3:
We have seen the use of 2D arrays for matrix computations in class. 2D arrays
can also be used to make look-up tables. You are required to make a look-up
table of 100 elements for the trigonometric sin() function in a program. The
program should follow the following sequence.
1) Define a 2D float array sinelookup [100] [2].
2) Fill column 0 of sinelookup [ ] [ ] with values from 0.000000 to 2
(6.283185) using loop. The step size for increment can be computed using
formula: (2-0)/(100-1)
3) Fill column 1 of sinelookup [ ] [ ] with values of sin() of the corresponding
value in column 0 using loop; for example
sinelookup [0] [1] =
sin(sinelookup [0] [0]), similarly
sinelookup [0] [2] = sin(sinelookup [1] [0]) etc.
4) Once sinelookup [ ] [ ] is filled, ask the user to enter any angle in radians
and search for the sine value of that angle from sinelookup [ ] [ ]. Use
sequential search.
Note: This is the method for implementation any trigonometric function as a
computer language function.
Question 4:
Write a program that performs cyclic shift operation to an integer array by a
function cyclicshift_int(). The prototype for this function looks like:
void cyclicshift_int(int array[ ], int start, int stop, int shift);
Here;
array[]: the array passed to the function upon which cyclic shift is operated,
start: starting index,
stop: stopping index,
shift: amount of shift provided to array.
Consider int num[5]={12,52,77,4,9};
0
12

1
52

2
77

3
4

4
9

If the array passed to this function is num[5] with the following call:
cyclicshift_int(num, 0, 4, 2);
The shifted array looks like:
0
4

1
9

2
12

3
52

4
77

[EE-262 PROGRAMMING WITH C LANGUAGE]

Das könnte Ihnen auch gefallen