
The code is in C++. All the explanation is in the code comments. Hope this helps!
Code:
#include <iostream>
using namespace std;
// function 1
void CapLock(char *c)
{
// lowercase letter
if(*c >= 'a' && *c <= 'z')
{
// change to upper case
*c = (*c - 'a') + 'A';
}
// uppercase letter
else if(*c >= 'A' && *c <= 'Z')
{
// change to lowercase
*c = (*c - 'A') + 'a';
}
// else do nothing
}
// function 2
double Minimum(double d1, double d2, double d3, double d4)
{
// compare first 2 numbers
if(d1 < d2)
{
// compare 1st and 3rd numbers
if(d1 < d3)
{
// compare 1st and 4th numbers
if(d1 < d4)
// d1 is the Minimum
return d1;
// d4 is the Minimum
return d4;
}
// compare 3rd and 4th numbers
if(d3 < d4)
// d3 is the Minimum
return d3;
// d4 is the Minimum
return d4;
}
// compare 2nd and 3rd numbers
if(d2 < d3)
{
// compare 2nd and 4th numbers
if(d2 < d4)
// d2 is the Minimum
return d2;
// d4 is the Minimum
return d4;
}
// compare 3rd and 4th numbers
if(d3 < d4)
// d3 is the Minimum
return d3;
// d4 is the Minimum
return d4;
}
int main()
{
// sample run
// for function CapLock()
char c1 = 's', c2 = 'T', c3 = '7';
cout << "For " << c1 << ", CapLock() = ";
CapLock(&c1);
cout << c1 << endl;
cout << "For " << c2 << ", CapLock() = ";
CapLock(&c2);
cout << c2 << endl;
cout << "For " << c3 << ", CapLock() = ";
CapLock(&c3);
cout << c3 << endl << endl;
// for function 2
double d1 = 13.4, d2 = 10.4, d3 = 9.7, d4 = 13.02;
cout << "Minimum of " << d1 << ", " << d2
<< ", " << d3 << " and " << d4 << " =
";
cout << Minimum(d1, d2, d3, d4) << endl;
return 0;
}
Sample run:

Code screenshot:
write the function definition call the function from main and make sure it works as required....
In the space below, write a C function definition for a function named StrLower, which will receive one parameter, a pointer to a null-terminated string (i.e., pointer to char), convert each character in the string to lowercase (using the tolower function from <ctype.h>), and return nothing to the caller. Inside the function definition, you may use a for loop or a while loop. If you use any variables other than the incoming parameter, you must define them locally in the...
Write a full class definition for a class named GasTank , and containing the following members:A data member named amount of type double.A constructor that no parameters. The constructor initializes the data member amount to 0.A function named addGas that accepts a parameter of type double . The value of the amount instance variable is increased by the value of the parameter.A function named useGas that accepts a parameter of type double . The value of the amount data member...
Write only a python function definition for a function that takes two strings values as its parameters , and if the first parameter alphabetically comes later in a dictionary than the second parameter then the function returns the length of the first parameter, otherwise the function returns the negative of the length of the second parameter. Name your function fA. For instance : fA(“do”,”can”) returns 2
definition contains the statements that make up the function. definition contains the statements that make up the function. Do you know what is a function definition? Do you know what is the parameter of a function? Do you know what is the return type of a function? Do you know how to handle the function that returns the value? Do you know how to use/call a function? Do you know how to use/call a function that has a return type...
What is wrong with the following function definition? void fill(const int a[], int size) { for (int i = 0; i < size; i++) { a[i] = 0; } return; } Answers: The function cannot change the array parameter. The array should be passed as a call-by-reference, not call-by-value. The for loop causes an out-of-bounds indexing error. Nothing, the code works fine as is.
Write the definition of a function named timeOnHighway that receives three parameters, all of type double: mileEndingPoint , mileStartingPoint , and speed . The first two parameters indicate the mile markers on an interstate at which a vehicle goes to and starts at; the third parameter indicates the speed of the vehicle in miles per hour. The function returns the number of hours it takes a vehicle to go from the starting mile marker to the ending one. The function...
trouble with formatting titles :( Your friend is in charge of recording titles of books in the library they work in. Since they know you're in EECS 183, they've asked you to write a function that turns a lowercase string into Title Case format. This way, they can use the function to correctly format the titles without having to worry about capitalizing anything themselves. The function you will implement is stringToTitleCase, which takes a lowercase string str as input and...
Need help problem 9-13
C++ Homework please help
WRITE FUNCTION PROTOTYPES for the following functions. The functions are described below on page 2. (Just write the prototypes) When necessary, use the variables declared below in maino. mm 1.) showMenu m2.) getChoice 3.) calcResult m.) showResult 5.) getInfo mm.) showName 7.) calcSquare 8.) ispositive int main { USE THESE VARIABLES, when needed, to write function prototypes (#1 - #8) double num1 = 1.5; double num2 = 2.5; char choice; double result;...
Write a function that takes two string parameters which represent the names of two people and returns True if the people are a "match" and False if they are not. Determining Love Total all the ‘L’s ‘O’s ‘V’s and ‘E’s (uppercase and lowercase) found in each of their names. If the number of LOVE letters combined between both their names is odd, return True. If the number of LOVE letter combined between both their names is even, return False. *...
4) Write a function named remove that returns void, takes in a string& called word, and an int called i that, starting from index 0, removes every ith letter from word by modifying it in place. Include a functional main method to make sure the program works. Programming language is C++, thanks in advance