Every DNA sequence consists of four nucleotides: Adenine, Thymine, Cytosine, and Guanine,
referred to by the first letters of their chemical names (A, T, C, and G). Your goal is to provide a report of the number of each nucleotide within the sequence, and the percent each nucleotide makes up of the total. You should include your output file in the submission in addition to our usual submission format (console output + code).
Example Output:
DNA sequence analysis:
29782 nucleotides in the sequence
Sequence breakdown:
Adenine: 8892 29.86%
Thymine: 9581 32.17%
Cytosine: 5462 18.34%
Guanine: 5847 19.63%
Here is my program:
int main()
{
int A = 8892, T = 9581, C = 5462, G = 5847;
cout << "DNA sequence analysis: " << endl;
cout << 29782 << "nucleotides in the sequence " << endl;
cout << "Sequence breakdown: " << endl;
cout << "Adenine: " << A << " " << 29.86 << "%" << endl;
cout << "Thymine: " << T << " " << 32.17 << "%" << endl;
cout << "Cytosine: " << C << " " << 18.34 << "%" << endl;
cout << "Guanine: " << G << " " << 19.63 << "%" << endl;
}
Comments
Leave a comment