Assume that a , b and c are char variables has been declared . Write some code that reads in the first character of the next line into a, the first character of the line after that into b and the first character of the line after that into c . Assume that the lines of input are under 100 characters long.

C++

LANGUAGE: C++ CHALLENGE: Assume that a , b and c are char variables has been declared . Write some code that reads in the first character of the next line into a, the first character of the line after that into b and the first character of the line after that into c . Assume…

Read More

Given the availability of an ofstream object named output, and a string variable name tweet, write the other statements necessary to open a file named mytweet”, display the prompt tweet: and then read an entire line into tweet and then write it out to the file mytweet. (Do not define a main function.)

C++

LANGUAGE: C++ CHALLENGE: Given the availability of an ofstream object named output, and a string variable name tweet, write the other statements necessary to open a file named mytweet”, display the prompt tweet: and then read an entire line into tweet and then write it out to the file mytweet. (Do not define a main…

Read More

In molecular biology the “”alphabet”” of genes consists of four chemicals (called nucleotides) represented by the letters A C G T. A triad is a sequence of three nucleotides (for example AGA) and specifies an amino acid, a building block for proteins. A gene consists of a very, very long sequence of A-C-G-T combinations. Assume the input consists of a long sequence of A-C-G-T letters representing a gene. Write the code necessary to skip over the first 7 letters and then read the next 4 triads, printing each out on its own line.

C++

LANGUAGE: C++ CHALLENGE: In molecular biology the “alphabet” of genes consists of four chemicals (called nucleotides) represented by the letters A C G T. A triad is a sequence of three nucleotides (for example AGA) and specifies an amino acid, a building block for proteins. A gene consists of a very, very long sequence of…

Read More

A U.S. social security number consists of a string of 9 digits, such as “444422333”. Assume that input consists of a sequence of 9-digit social security numbers with no intervening spaces or separators of any kind: 111223333444422333123456789987654321… Assume that a char array named ssn suitable for storing a social security number as a C-string has been declared. Use this array to read in 3 successive social security numbers and print each one out on a line by itself.

C++

LANGUAGE: C++ CHALLENGE: A U.S. social security number consists of a string of 9 digits, such as “444422333”. Assume that input consists of a sequence of 9-digit social security numbers with no intervening spaces or separators of any kind: 111223333444422333123456789987654321… Assume that a char array named ssn suitable for storing a social security number as…

Read More

A U.S. social security number consists of a string of 9 digits, such as “444422333”. Declare a char array named ssn suitable for storing a social security number as a C-string, and write a statement that reads in the next 9 characters of standard input into this array. (Assume that the input consists of one big sequence of digits without spaces or newlines.)

C++

LANGUAGE: C++ CHALLENGE: A U.S. social security number consists of a string of 9 digits, such as “444422333”. Declare a char array named ssn suitable for storing a social security number as a C-string, and write a statement that reads in the next 9 characters of standard input into this array. (Assume that the input…

Read More

Declare a char array named line suitable for storing C-strings as large as 50 characters, and write a statement that reads in the next line of standard input into this array. (Assume no line of input is 50 or more characters.)

C++

LANGUAGE: C++ CHALLENGE: Declare a char array named line suitable for storing C-strings as large as 50 characters, and write a statement that reads in the next line of standard input into this array. (Assume no line of input is 50 or more characters.)

Read More