Sie sind auf Seite 1von 7

ECE2

Instructions
1.Last date for submitting case studies is 05-01-15
2.Code, debug, comment, and print the source code for all programs. All
programs must contain your name, date and code comments. Points will be
deducted on programs that are not well coded and commented pages that
are unstapled.
3.Execute programs three times with different input.
4.Print the output from all executions (use ALT PrintScreen to capture the
output window and then paste into Wordpad or MS Word).
5.Include a program message explaining the objective of the program to
the user.
6.for documentation write aim,problemstatement,algorithmand results
7.one softcopy should be submitted to srujanainturi@cbit.ac.in mail-id
8.hardcopy to be submitted personally on or before 05-01-15

CASE STUDY1 (roll nos 10(Leader),20,30,40,50,60)


1. Write a program to compute Lambda (n) for all positive values of n where

Lambda(n) can be recursively defined as


Lambda (n) =Lambda (n/2) + 1 if n>1
AND Lambda (n) =0 if n=1
2. Write a menu-driven program to perform various string operations using
pointers.
3. Define a structure date containing three integers-day, month, and year.
Write a program using functions to read data, to validate the date entered by
the user and then print the date on the screen. For example, if you enter
29,2,2010 then that is an invalid date as 2010 is not leap year. Similarly
31,6,2007 is invalid as june does not has 31 days.

CASE STUDY2 (roll nos 1(Leader),11,21,31,41,51,13-56)


1. Write a program to compute F(M,N) where F(M,N) can be recursively

defined as

F (M, N) = 1 if M=0 or
AND F (M, N) =F (M-1, N) + F(M-1,N-1)
2.Write a menu driven program to read a string, display the string, merge
two strings, copy n characters from the mth position, calculate the length of
the string.
3.Write a program to define a structure for a hotel that has members- name,
address, grade, number of rooms, and room charges. Write a function to
print the names of a hotel in a particular grade. Also write a function to print
names of a hotel that have room charges less then the specified value.

CASE STUDY3 (roll nos 2(Leader),12,22,32,42,52)


1.Write a program to convert the given string Hello world to dlrow olleh
without using recursion
2.Write a program to input an array of strings. Then reverse the string in the
format shown below.
HAPPY BIRTHDAY TO YOU should be displayed as YOU TO BIRTHDAY
HAPPY.
3. Declare a structure time that has three field-hr, min, secs. Create two
variables start_time and End_time. Input their values from the user. Then
while start_time does not reach the end_time Display GOOD DAY on the
screen.

CASE STUDY4 (roll nos 3(Leader),13,23,33,43,53)

1.Write a program to find HCF of two numbers a) using recursion b) without


using recursion
2.Write a program to (a) read a name and then display it in abbreviated form,
(b) Janak Raj Thareja should be displayed as JRT; (c) Janak Raj Thareja should
be displayed as J.R.Thareja.
3.Declare a structure POINT. Input the co-ordinates of a point variable and
determine the quadrant in which it lies. The following table can be used to
determine the quadrant.
Quadrant

Positive

Positive

Negative

Positive

Negative

Negative

Positive

Negative

CASE STUDY5 (roll nos 4(Leader),14,24,34,44,54)


1.Write a program that tests the equality of two one-dimensional arrays.
2.If substring function is given as- SUBSTRING(string, position, length) then,
find S(5,9) if S=Welcome to world of c programming .
3. Write a program to calculate the area of one of the geometric figurecircle, rectangle or a triangle. Write a function to calculate the area. The
function must receive one parameter which is a structure that contains the
type of figure and the size of the components needed to calculate the area
must be a part of a union. Note that a circle requires just one component and
a triangle requires the size of three components to calculate the area

CASE STUDY6 (roll nos 5(Leader),15,25,35,45,55)


1.Write a program to input the elements of a two-dimensional array. Then
from this array make two arrays- one that stores all odd elements of the two
dimensional array and the other stores all even elements of the array.

2.If index function is given as- INDEX( text, pattern), then find the index(T,P)
where T=Welcome to world of c programming.
3.Write a program to create a structure with information given below. Then
read and print the data.
Employee[10]
a) Emp_Id
b) Name
i. First name
ii.
Middle name
iii.
Last name
c) Address
i. Area
ii.
City
iii.
State
d) Age
e) Salary
f) Designation

CASE STUDY7 (roll nos 6(Leader),16,26,36,46,56)


1.Write a menu driven program to add, subtract, and transpose two matrices.
2.Write a program that accepts an integer value from 0 to 999. Display the
value of the number read in words. That is, if the user enters 753, then print
Seven hundred fifty three.

CASE STUDY8 (roll nos 8(Leader),18,28,38,48,58)


1.Write a program that reads a matrix and displays the sum of its diagonal
elements.
2.Write a program to input a text of at least two paragraphs. Interchange the
first and second paragraphs and then re-display the text on screen.
3.Read two integers, representing a rate of pay (pence per hour) and a
number of hours. Print out the total pay, with hours up to 40 being paid at
basic rate, from 40 to 60 at double-rate. Print the pay as pounds to two
decimal places.

Hint: Construct a loop. Terminate the loop when a zero rate is encountered. At the end of
the loop, print out the total pay. The code for computing the pay from the rate and hours
is to be written as a function.

The recommended output format is


Pay at 200 pence/hr for 38 hours is

76.00 pounds

Pay at 220 pence/hr for 48 hours is 114.40 pounds


Pay at 240 pence/hr for 68 hours is 206.40 pounds
Pay at 260 pence/hr for 48 hours is 135.20 pounds
Pay at 280 pence/hr for 68 hours is 240.80 pounds
Pay at 300 pence/hr for 48 hours is 156.00 pounds
Total pay is 928.00 pounds
The program features check that explicit values such as 40 and 60
appear only once, as a #define or an initialized variable value.

CASE STUDY9 (roll nos 9(Leader),19,29,39,49,59)


1.Write a program to merge two integer arrays. Also display the merged
array in reverse order
2. Write a program to input a text of at least two paragraphs. Construct an
array PAR such that PAR[I] contains the location of the Ith paragraph in TEXT.
3.Write a program that performs the following. The user inputs the number
and then enters a series of numbers from 1 to that number. Your program
should determine which number (or numbers) is missing or duplicated in the
series, if any. For example, if the user entered 5 as the initial number and
then entered the following sequences, the results should be as shown.
Input sequence

Output

-------------------------------------------------1 2 3 4 5

Nothing bad

However, if 7 were the highest number, the user would see the results on
the right for the following number entries:
Input sequence
----------------------1 3 2 4 5

Output
---------------------Missing 6
Missing 7

And if 10 were the highest number and the user entered the numbers
shown on the left, note the list of missing and duplicate numbers:
Input sequence
-----------------------------------------1 2 4 7 4 4 5 10 8 2 6
times)

Output
---------------------Duplicate 2 (2
Missing 3
Duplicate 4

(3 times)
Missing 9
The program should check the highest number that the user inputs to
ensure that it does not exceed the size of any array you might be using
for storage.

Das könnte Ihnen auch gefallen