Name: Anonymous 2012-02-03 11:28
so i got this c++ engineering assignment and im subpar at it, i know its not hard to do the first function with and array and the second one with true false statements and a for loop but we havent learned either yet so i cant use them, any suggestions?
The functions you are to implement are as follows:
int phoneKey(char l)
A function that returns the digit value (an integer) corresponding to the letter passed to it as an argument based on the encoding on a telephone handset. For example, if the argument is the letter a, b, or c (uppercase or lowercase), your function should return the digit 2. If the argument is not one of the letters of the alphabet, return a value of -1.
int dayNumber(int day, int month, int year)
A function that returns the day number (1 to 366) in a year for a date that is provided as input data. As an example, January 1, 1994 is day 1. December 31, 1993 is day 365. December 31, 1996 is day 366 since 1996 is a leap year. Write and use a second function that returns true if its argument, a year, is a leap year. A year is a leap year if it's divisible by four, except that any year divisible by 100 is a leap year only if it's also divisible by 400. (Hint: If x and y are integers and x is divisible by y, then what will be the value of x % y?
help a aspiring mechanical engineer with no desire to do programming out!
The functions you are to implement are as follows:
int phoneKey(char l)
A function that returns the digit value (an integer) corresponding to the letter passed to it as an argument based on the encoding on a telephone handset. For example, if the argument is the letter a, b, or c (uppercase or lowercase), your function should return the digit 2. If the argument is not one of the letters of the alphabet, return a value of -1.
int dayNumber(int day, int month, int year)
A function that returns the day number (1 to 366) in a year for a date that is provided as input data. As an example, January 1, 1994 is day 1. December 31, 1993 is day 365. December 31, 1996 is day 366 since 1996 is a leap year. Write and use a second function that returns true if its argument, a year, is a leap year. A year is a leap year if it's divisible by four, except that any year divisible by 100 is a leap year only if it's also divisible by 400. (Hint: If x and y are integers and x is divisible by y, then what will be the value of x % y?
help a aspiring mechanical engineer with no desire to do programming out!