Professional Documents
Culture Documents
Assignment-VI Au23
Assignment-VI Au23
Write your name, roll number and assignment number in the header of the
program file as comments. You may give your program file name as
<asgn><no_><RollNo>.c. Submit all the programs in the Moodle System 15
minutes before the end of the laboratory session. Provide also output files
containing results given the set of inputs given here. Please follow the
instruction for generating result files provided at the end.
T= (m1-m2)/ √ (s12/N1+s22/N2)
list2: N2: 10
26.4, 88.1, -34.7, -40.2, 222.3, 56.4, 12.4, 43.2, -35.7, -88.8
36.2, 68.5, 331.3, -44.4, -220.4, -66.2, -120.8, 430.3, -432.9, -45.7
list2: N2: 15
16.4, 18.1, -14.7, -43.2, 22.3, -156.2, 125.3, -143.2, -55.7, -78.8, 26.4, 18.2,
-4.5, 7.9, 27.3
For the above, the program should ensure that Number_of_rivers for a record
should not exceed 5, and the variable is initialized to 0.
The name of a river is a variable length string and should be dynamically
allocated. (You may use a temporary array of fixed size to store the name which
is read.)
The memory allocated to a river name must be deleted when the river is
deleted.
The program also implements the following function using appropriate list of
arguments:
Run your program with the following test data (a file with the data of initial
records of students is also provided for your convenience):
Initial records:
N=10
India
New Delhi
3287.263
USA
Washington, DC
9161.966
Russia
Moscow
17075.2
Germany
Berlin
349.223
Israel
Tel Aviv
0.440
U.K.
London
242.495
Bangladesh
Dhaka
147.570
Pakistan
Islamabad
881.913
Srilanka
Colombo
65.610
Nepal
Kathmandu
147.181
All the results for each assignment should be submitted together in a separate
file (named result.txt). Provide the result in a separate output file (named,
result_<assgn><no>.txt). Use standard output redirection feature to generate
the output file.
Hints. Suppose you would like to redirect your output to a file ‘result.txt’.
If you run the program with the following command
./a.out >result.txt
Output of your program (generated by printf(.) function) will be written
in file result.txt. You need to provide input from your input, by
remembering the sequence of inputs to be given.
If you execute the program multiple times, you may concatenate the
outputs in a single file by using the following redirection command:
./a.out >>result.txt
Input redirection (optional):
You may also store your input (the ordering as per requirement of
the program should be preserved) in an input file in.txt, and execute the
program as follows: