Write your own string compare function that compares the two string and return 1 if
they are equal else 0.
Write a program that search a string from multidimensional array of characters.
Write a program that converts all lowercase characters in a given string to its
equivalent uppercase character.
Exercise 2: Battery Model
We want to design a program to manage battery models.
(a) Define a type, BatteryModel, that represents a battery model, that is made of the known voltage , the amount of energy
it is capable of storing, and the energy it is currently storing (in joules).
(b) Define a function PowerDevice that takes as arguments: a current of an electrical device (amps), a battery of type
BatteryModel, and the time the device is to be powered by the battery (seconds), and determines whether the battery's energy reserve is adequate to power the device. If so, the function updates its reserve by subtracting the energy consumed and returns the value 1. Otherwise it returns the value 0 and leaves the energy reserve unchanged.
(c) Define a function MaxTime that takes as arguments: a current of an electrical device and a battery of type BatteryModel,
and returns the number of seconds this battery can operate the device before it is fully discharged. This function may not modify the energy reserve.
Exercise 1: Largest contiguous partial sum
(a) Write a function that will find the largest contiguous partial sum, LagestSum, within an array of real numbers. That is,
we want to sum up any number of neighboring elements from the array, starting from anywhere, find the largest possible
sum.
-3 4 2 1 -4 6 -10 0 -4 3
then the function should report return 9, because 4+2+1+(-4)+6= 9 is the largest sum of contiguous elements from that array of numbers. The function must also provide the starting and the ending indices of the summed elements back to its caller(indices 1 and 5 for the example above).
(b) Write a driver program that tests the function LargesttSum written in (a).
Write a program to arragne the names in assending order using call by value.
In a library management system auditing is a complex task for a librarian. The stock maintenance has manual entries that may have multiple entries of book access number. The library management system should be automated to remove duplicate book access number. Write a program to remove duplicate numbers using call by reference to a funcftion.
Exercise 1: Largest contiguous partial sum
(a) Write a function that will find the largest contiguous partial sum, LagestSum, within an array of real numbers. That is,
we want to sum up any number of neighboring elements from the array, starting from anywhere, find the largest possible
sum.
-3 4 2 1 -4 6 -10 0 -4 3
then the function should report return 9, because 4+2+1+(-4)+6= 9 is the largest sum of contiguous elements from
that array of numbers. The function must also provide the starting and the ending indices of the summed elements back
to its caller(indices 1 and 5 for the example above).
(b) Write a driver program that tests the function LargesttSum written in (a)
1. C language is an example of imperative / procedural language, but since it is old (no OO or functional programming allowed), is no more required to industry.
True or False
2. Considering an ANSI C compiler what can represent a lexical error?
a. a = )a+(b;
b. a = 0.0a;
c. if (a=3) a++;
d. a = α{"version":"1.1","math":"α"}~b;
Write a C Program to Rent a cycle on hourly basis
Per hour charges. Rs. 90 /hour
10 bicles
25 clients
90 per hr charges
Reports
Monthly bill of all cyclists
Every client don't take cycle on rent at daily basis but Can take regular and more than one hour daily