C++
Assume that word is a variable of type string that has been assigned a value. Write an expression whose value is a string consisting of the first three characters of the value of word. So if the value of word were “dystopia” the expression’s value would be “dys”.
LANGUAGE: C++ CHALLENGE: Assume that word is a variable of type string that has been assigned a value. Write an expression whose value is a string consisting of the first three characters of the value of word. So if the value of word were “dystopia” the expression’s value would be “dys”.
Read MoreAssume that name is a variable of type string that has been assigned a value. Write an expression whose value is a string containing the second character of the value of name. So if the value of name were “Smith” the expression’s value would be “m”.
LANGUAGE: C++ CHALLENGE: Assume that name is a variable of type string that has been assigned a value. Write an expression whose value is a string containing the second character of the value of name. So if the value of name were “Smith” the expression’s value would be “m”.
Read MoreAssume that name is a variable of type string that has been assigned a value. Write an expression whose value is a string containing the last character of the value of name. So if the value of name were “Smith” the expression’s value would be “h”.
LANGUAGE: C++ CHALLENGE: Assume that name is a variable of type string that has been assigned a value. Write an expression whose value is a string containing the last character of the value of name. So if the value of name were “Smith” the expression’s value would be “h”.
Read MoreAssume that name is a variable of type string that has been assigned a value. Write an expression whose value is a string containing the first character of the value of name. So if the value of name were “Smith” the expression’s value would be “S”.
LANGUAGE: C++ CHALLENGE: Assume that name is a variable of type string that has been assigned a value. Write an expression whose value is a string containing the first character of the value of name. So if the value of name were “Smith” the expression’s value would be “S”.
Read MoreAssume that name is a variable of type string that has been assigned a value. Write an expression whose value is the second character of the value of name. So if the value of name were “Green” the expression’s value would be ‘r’.
LANGUAGE: C++ CHALLENGE: Assume that name is a variable of type string that has been assigned a value. Write an expression whose value is the second character of the value of name. So if the value of name were “Green” the expression’s value would be ‘r’.
Read MoreAssume that name is a variable of type string that has been assigned a value. Write an expression whose value is the last character of the value of name. So if the value of name were “Blair” the expression’s value would be ‘r’.
LANGUAGE: C++ CHALLENGE: Assume that name is a variable of type string that has been assigned a value. Write an expression whose value is the last character of the value of name. So if the value of name were “Blair” the expression’s value would be ‘r’.
Read MoreAssume that name is a variable of type string that has been assigned a value. Write an expression whose value is the first character of the value of name. So if the value of name were “Smith” the expression’s value would be ‘S’.
LANGUAGE: C++ CHALLENGE: Assume that name is a variable of type string that has been assigned a value. Write an expression whose value is the first character of the value of name. So if the value of name were “Smith” the expression’s value would be ‘S’.
Read MoreGiven a string variable address, write a string expression consisting of the string “http://” concatenated with the variable’s string value. So, if the value of the variable were “www.turingscraft.com”, the value of the expression would be “http://www.turingscraft.com”.
LANGUAGE: C++ CHALLENGE: Given a string variable address, write a string expression consisting of the string “http://” concatenated with the variable’s string value. So, if the value of the variable were “www.turingscraft.com”, the value of the expression would be “http://www.turingscraft.com”.
Read MoreAssume that word is a variable of type string that has been assigned a value. Assume furthermore that this value always contains the letters “”dr”” followed by at least two other letters. For example: “undramatic”,”dreck”, “android”, “no-drip”. Assume that there is another variable declared, drWord, also of type string. Write the statements needed so that the 4-character substring word of the value of word starting with “dr” is assigned to drWord. So, if the value of word were ” George slew the dragon” your code would assign the value “drag” to drWord.
LANGUAGE: C++ CHALLENGE: Assume that word is a variable of type string that has been assigned a value. Assume furthermore that this value always contains the letters “”dr”” followed by at least two other letters. For example: “undramatic”,”dreck”, “android”, “no-drip”. Assume that there is another variable declared, drWord, also of type string. Write the statements…
Read MoreWrite the definition of a function named fscopy. This function can be safely passed two fstream objects, one opened for reading, the other for writing. Assume that the input source is a text file consisting of a sequence of newline character -terminated lines. The function simply copies, line by line, the entire content of the data source associated with the first argument to the data target associated with the second argument. No value is returned.
LANGUAGE: C++ CHALLENGE: Write the definition of a function named fscopy. This function can be safely passed two fstream objects, one opened for reading, the other for writing. Assume that the input source is a text file consisting of a sequence of newline character -terminated lines. The function simply copies, line by line, the entire…
Read MoreDeclare a string named line and write a statement that reads in the next line of standard input into this variable.
LANGUAGE: C++ CHALLENGE: Declare a string named line and write a statement that reads in the next line of standard input into this variable.
Read MoreAssume that c is a char variable has been declared. Write some code that reads in the first character of the next line into c. Assume that the lines of input are under 100 characters long.
LANGUAGE: C++ CHALLENGE: Assume that c is a char variable has been declared. Write some code that reads in the first character of the next line into c. Assume that the lines of input are under 100 characters long.
Read More