Question
C++ Write functions as described below. Each function is just a few lines long. Pay attention to the types of the parameters and the types
C++
Write functions as described below. Each function is just a few lines long. Pay attention to the types of the parameters and the types being returned. Write testing code to test each function, testing them in the order they are described below.
int maxIntVal(int x, int y) {
//returns the largest of x and y
your code here
}
int sumN(int n) {
//returns the sum of the integers from 1 to n; assume n >= 0
your code here
}
bool isEven(int n) {
//returns true if n is an even number, false otherwise
}
string fixCaps(string s) {
//returns the string with the first letter capitalized and the rest of the
//letters lowercased
}
void toLowerCase(string &s) {
//modifies s so that it is all lowercase; this is a pass by reference
}
int xToY(int x, int y) {
//uses a loop to calculate x^y and return it; assume y >= 0
}
bool isAllCaps(string s) {
//return true if s is all capital ASCII letters, false otherwise
}
void toProperCaps(string &s) {
//modifies s so that the first character and any other characters which are
//after a blank are capitalized, all other letters are lowercased. This is a
//pass by reference.
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started