#include<iostream> using namespace std; int main() { string dna1,dna2,compare(""); double CG=0,pairs=0,validity,stability; cout<<"Enter DNA 1:"; getline(cin,dna1); cout<<"Enter DNA 2:"; getline(cin,dna2); for(int i=0; i<dna1.size(); i++) { if ((dna1[i]=='C'&&dna2[i]=='G')||(dna1[i]=='G'&&dna2[i]=='C')) { compare=compare+'|'; CG++; pairs++; } else if((dna1[i]=='A'&&dna2[i]=='T')||(dna1[i]=='T'&&dna2[i]=='A')) { compare=compare+'|'; pairs++; } else compare=compare+'X'; } validity=pairs*100/dna1.size(); stability=CG*100/pairs; cout<<dna1<<"\n"<<compare<<"\n"<<dna2; cout<<"\nValidity: "<<validity<<"%"; cout<<"\nStability: "<<stability<<"%"; return 0; }
What’s the C++ code to this? So that my output is: CCTAGAATG | | X |...
in c++ language please
Summary given 2 DNA strands of equal length, compare the bas Given two DNA strands of equal length, write a complete C++ program to compare the corresponding bases, and report mismatches. For example, suppose the input to your program are the following two DNA strands CCATGGTC CCAGTGAC then your program should produce the following output **Differences: 3 In other words, your program should output the first strand, then on the next line output a space if...
Three C Code Questions: 5. Write a C program that declares an array of 10 strings, each of max length 50 characters, and then reads an entire line of text from the keyboard into each string. 6. Write C code that finds the longest name in this array of strings that you read in Q5. Hint: find the position of the longest string, not the string itself. 7. Write a C program that creates a 4 x 6 two dimensional...
Can someone help me with this, and it has to be written in the C programming language: Write a program that reads a string from the keyboard. If the length of the string is an even number, your program should split the string into two strings of equal length. If the length of the string is odd, your program should split the string into two strings where the first part has one more character than the second part. Your program...
Write a c program that reads a string with a maximum length of 30 from the keyboard[1]. The program should then copy the characters from that input string into a second character array (in order of input). However, only if a character is a vowel (a, e, i, o, u) should it be copied into the second array. Once copied, the program should output the values stored in the second array (in order of input). The program should then count...
Write a program that prompts the user to input a string and then outputs the string in the pig Latin form. The rules for converting a string into pig Latin form are asfollows:a. If the string begins with a vowel, add the string "-way" at the end of the string. for example, the pig Latin form of the string "eye" is "eye-way".b. If the string does not begin with a vowel, first ass "-" at the end of the string....
IN C language Write a C program that prompts the user to enter a line of text on the keyboard then echoes the entire line. The program should continue echoing each line until the user responds to the prompt by not entering any text and hitting the return key. Your program should have two functions, writeStr andcreadLn, in addition to the main function. The text string itself should be stored in a char array in main. Both functions should operate...
Write Java code to implement a FSM machine that recognizes the language for the alphabet {a,b,c} consisting of all strings that contain two consecutive c's and end with b. Your FSM program should include the following three static methods (Java) or functions (C): a. int nextState(int state, char symbol) A state-transition function that returns the next state based on the current state and an input symbol. This function should also return -1 when an invalid input character is detected. State...
Use c-strings for the following project: Write a C++ program that declares an array containing up to a maximum of 20 sentences, each sentence of maximum 81 characters long, using c-strings. Continue reading sentences from the user and store them in the array of sentences, until the user enters a NULL string for the sentence or 20 sentences have been entered. Then, one by one, display each sentence entered by the user and present the following menu of operations on...
Hi everyone, I have a problem about C programming.
Background Material:
The figure 6 is as below:
The task:
Download the file 55.c. Study the C code, then build an
executable and run it to see what the output is. Modify the program
so that the output is The string in buffer is "In C the value of 12
+ 34 / 5 is 18." Do this by looking up decimal values for ASCII
codes in Figure 6 and typing...
Use C++ language, keep it simple
Exercise #2: Strings' operations Write a C++ program that prompts the user to enter a sentence, the program then does the following: 1. Prints the total characters in the sentence. 2. Prints the word count of the sentence, assuming only one space between each tow words. 3. Prints total vowel (a, e, i, o, u) in the sentence. 4. Prints the vowel frequency as shown in the sample below. 5. Prints the sentence in...