Question: The goal is to write a complete C++ program that inputs 2 strings from the keyboard, where each string denotes a DNA strand such as

The goal is to write a complete C++ program that inputs 2 strings from the keyboard, where each string denotes a DNA strand such as CCTAGAATC. The program will then line up the two strands to see how many of the pairs form valid base pairs, i.e. that a C is paired with a G and an A is paired with a T. The program also outputs the percentage of valid base pairs, and the stability of the DNA strand formed by the valid base pairs. For example, suppose the following two strings are input from the keyboard: CCTAGAATC and GGACCTAAC. The program outputs the following:

CCTAGAATG

| | | X | | X | |

GGACCTAAC

Validity: 77.7778%

Stability: 57.1429%

The program outputs the 1st strand, then compares each characters in the first strand to the corresponding character in the second strand. If the characters form a valid base pair,

then | is output connecting the two characters (thats the vertical bar character on right - side of keyboard). If the characters do not form a valid base pair, the 'X' is output denoting that the pair is not valid. This output is followed by the 2nd strand, and then the percentage of valid pairs (7/9 in this case) and the stability of the DNA strand formed by the valid base pairs. The notion of stability is defined as the percentage of C and G characters in the subset of valid base pairs (from either string). For example, given the strings above, pick either string. There are 7 valid base pairs, and within those 7 there are 4 C and G characters. So that's 4/7, or 57.1429%.

Assume the user will enter valid strings that contain a sequence of capital letters consisting of 'A', 'C', 'G', and 'T'.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!