Question
Coding in C++ (1) Write a function called changeLetter that can directly alter the value of a character variable. It takes one argument: a reference
Coding in C++
(1) Write a function called changeLetter that can directly alter the value of a character variable. It takes one argument: a reference to a character. It returns nothing. If the passed in character is alphabetic ('a' to 'z' or 'A' to 'Z'), then make the character become the next higher ASCII value ('a' becomes 'b' etc.). If the passed in character is not a letter, don't alter it.
(2) Write a calling statement for the changeLetter function. It takes one argument: a reference to a character and returns nothing. The calling statement should pass the char variable ch so that it is (potentially) altered.
(3) Write a calling statement for the changeLetter function. It takes one argument: a reference to a character and returns nothing. The calling statement should pass the 2nd character in a char array called chAr (by second, I mean the sub-oneth) so that it is (potentially) altered.
(4) Assume the following function header: void fn( int &n )
Write an instruction for the function body that will store 10 into the caller's variable referred to by n.
(5) Write a calling statement for the fn function. It takes one argument: a reference to an integer and returns nothing. The calling should pass the integer variable num to the function so that it can be altered.
(6) What must be true of the arguments to strcat(s1, s2); More than one answer may be correct
a. s1 must be valid strings
b. s2 must be a valid string
c. s1 must have room to contain the result
d. s2 must have room to contain the result
(7) How is a structure different from an array?
(9) Write a definition for a structure called Part that can hold a part name (an array of characters that can hold 24 characters plus a null terminator), a part weight (int), and a part price (float). Make up appropriate names.
(10) Assume the following structure definition:
struct Person { char name[50]; int age; };
Write a declaration for a variable of type Person and initialize it with your name and the age 10. This should be done as part of the variable declaration statement.
(11) Assume the following structure definition:
struct Person { char name[50]; int age; };
Write a declaration for a variable of type Person and initialize it with your name and the age 10. This should be done as several executable statements.
(12) Declare an array of 10 Person structures named peopleArray.
(13) Assume the following structure definition and declaration:
struct Person { char name[50]; int age; }; Person people[265];
Assuming that the people array contains 265 valid structs, write code to print out the age member for each item in the structure.
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