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”.

C++

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 More

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”.

C++

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 More

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”.

C++

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 More

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”.

C++

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 More

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’.

C++

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 More

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’.

C++

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 More

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’.

C++

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 More

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”.

C++

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 More

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 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.

C++

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 More

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 content of the data source associated with the first argument to the data target associated with the second argument. No value is returned.

C++

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 More