C++
Write a statement that would print your last name, followed by a comma, followed by your first name.
LANGUAGE: C++ CHALLENGE: Suppose your name was Alan Turing. Write a statement that would print your last name, followed by a comma, followed by your first name. Do not print anything else (that includes blanks).
Read MoreWrite a statement that prints Hello World to the screen.
LANGUAGE: C++ CHALLENGE: Write a statement that prints Hello World to the screen.
Read MoreSpecify the seating order as the names separated by commas.
CHALLENGE: Five friends are going to the theater. They have purchased a row of five seats with an aisle on either end. James doesn’t want to sit next to Jill Betty and Herb are dating and want to sit next to each other Bob must sit on an aisle Provide a seating order that conforms…
Read MoreWrite an arithmetic expression that calculates the average of 18 and 46.
CHALLENGE: Write an arithmetic expression that calculates the average of 18 and 46.
Read MoreFounder of Computer Science
CHALLENGE: A British logician, whose last name was ______ was the founder of Computer Science.
Read MoreWrite a statement that assigns x the value k*(k-1)*(k-2)*…*3*2*1 by calling the fact function and multiplying its return value by k.
LANGUAGE: C++ CHALLENGE: Assume the availability of a function called fact. The function receives an int argument and returns an int value . If the argument is one or smaller, it returns the integer value one. Otherwise it returns the product of all the integers from one to its argument . So the value of fact(4) is 1*2*3*4 and…
Read MoreWrite a bool -function named equals that recursively determines whether its two int parameters are equal and returns true if they are and false otherwise.
LANGUAGE: C++ CHALLENGE: Two non-negative integers x and y are equal if either: Both are 0, or x-1 and y-1 are equal Write a bool -function named equals that recursively determines whether its two int parameters are equal and returns true if they are and false otherwise.
Read MoreThe elements of an integer -valued array can be set to 0 (i.e., the array can be cleared) recursively as follows: An array of size 0 is already cleared; Otherwise, set the first element of the array to 0, and clear the rest of the array Write a void function named clear that accepts an integer array, and the number of elements in the array and sets the elements of the array to 0.
LANGUAGE: C++ CHALLENGE: The elements of an integer -valued array can be set to 0 (i.e., the array can be cleared) recursively as follows: An array of size 0 is already cleared; Otherwise, set the first element of the array to 0, and clear the rest of the array Write a void function named clear that…
Read MoreWrite a recursive, string -valued function, reverse, that accepts a string and returns a new string consisting of the original string in reverse.
LANGUAGE: C++ CHALLENGE: Write a recursive, string -valued function, reverse, that accepts a string and returns a new string consisting of the original string in reverse. For example, calling reverse with the string goodbye returns the string eybdoog. Reversing a string involves: No action if the string is empty or has only 1 character (reversing a…
Read MoreWrite a recursive, int -valued function, len, that accepts a string and returns the number of characters in the string.
LANGUAGE: C++ CHALLENGE: Write a recursive, int -valued function, len, that accepts a string and returns the number of characters in the string . The length of a string is: 0 if the string is the empty string (“”). 1 more than the length of the rest of the string beyond the first character.
Read MoreDeclare an array named winarr, consisting of 3 Window objects , where the first element is an 80×20 window, the second a 10×10 window, and the third a 133×40 window.
LANGUAGE: C++ CHALLENGE: Assume a class Window with a constructor that accepts two integer arguments : width and height (in that order). Declare an array named winarr, consisting of 3 Window objects , where the first element is an 80×20 window, the second a 10×10 window, and the third a 133×40 window.
Read MoreModify the program so that the computer plays a more informed game.
LANGUAGE: C++ CHALLENGE: The computer player in Programming Project 15.5 does not play the number guessing game very well, since it makes only random guesses. Modify the program so that the computer plays a more informed game. The specific strategy is up to you, but you must add function(s) to the Player and ComputerPlayer classes…
Read More