Week 8: Programming Assignment 1
Due on 2022-03-24, 23:59 IST
Consider the following program. Fill in the blanks as per the instructions given below:
•at LINE-1 with appropriate template definition,
•at LINE-2 and LINE-3 with appropriate template and function header for add() function,
•at LINE-4 and LINE-5 with appropriate template and function header to overload function call operator,
such that it will satisfy the given test cases.
Input | Output | |
Test Case 1 | 4 10 20 30 40 a b c d | 40 30 20 10 d c b a |
Test Case 2 | 5 1 2 3 4 5 e f g h i | 5 4 3 2 1 i h g f e |
Week 8: Programming Assignment 2
Due on 2022-03-24, 23:59 IST
Consider the following program. Fill in the blanks as per the instructions given below to
complete the definition of functor Maximum with local state:
•at LINE-1 with appropriate unary_function statement,
•at LINE-2 with constructor header with initialization list,
•at LINE-3 with overloading the function call operator,
such that it will satisfy the given test cases.
Input | Output | |
Test Case 1 | 4 10 20 30 40 | avg = 25 |
Test Case 2 | 5 3 6 7 10 12 | avg = 7.6 |
Week 8: Programming Assignment 3
Due on 2022-03-24, 23:59 IST
Consider the following program. Fill in the blanks as per the instructions given below:
•at LINE-1 with definition of pointer to function type F_ptr, which can points functions
message_to_client1() and message_to_client2(),
•at LINE-2 with appropriate header of the function wrapper(),
•at LINE-3 with function call using the pointer to function,
such that it will satisfy the given test cases.
Input | Output | |
Test Case 1 | hello bhaskar nalini | client-1: hello from bhaskar client-2: hello from nalini |
Test Case 2 | welcome soumen anand | client-1: welcome from soumen client-2: welcome from anand |
No comments