1. Date and Time difference
Write functions, with given prototypes, for computing difference of dates and times:
int datediff(int y1,int m1,int d1,int y2,int m2,int d2,int& yd,int& md,int& dd);
// return value is the difference in number of days
// reference parameters used for difference in terms of years, months and days // write proper checks for leap year, number of days in months, etc.
int timediff(int h1,int m1,int s1,int h2,int m2,int s2,int& hd,int& md,int& sd);
// return value is the difference in number of seconds
// reference parameters used for difference in terms of hours, minutes and seconds
2. Cartesian and Polar conversion
Write a function that can convert Cartesian coordinates to Polar coordinates. Write another function for Polar to Cartesian conversion.
3. Geo-coordinates
Write a single function that can convert Geo-coordinates (Longitude and Latitude) expressed in degrees, minutes and seconds to their decimal equivalent.
Consider the following resources for explanation of Geo-coordinates and their conversion:
https://en.wikipedia.org/wiki/Geographic_coordinate_system https://www.latlong.net/degrees-minutes-seconds-to-decimal-degrees
4. Reduce fraction
Write a function that takes two positive integer arguments as the numerator and denominator of a fraction, and reduces the fraction. This reduction is achieved by dividing each of the two arguments by the greatest common divisor of the two integers. The function should return the value 0 (to indicate failure to reduce) if either of the two arguments is zero or negative, and should return the value 1 otherwise.
Thus, for example, if m and n are two integer variables with values 25 and 15 respectively; then passing them as parameter to reduce function, will result in their values 5 and 3, upon exit from the function.
Reviews
There are no reviews yet.