Question
Program Input : your program should prompt the user to enter two strings from keyboard, representing two DNA sequences on alphabete of {A, C, G,
Program Input: your program should prompt the user to enter two strings from keyboard, representing two DNA sequences on alphabete of {A, C, G, T}.
Error checking: before executing the algorithm, your program should check both strings to ensure only acceptable DNA letters (A, C, G, T) are entered. Do not run the algorithm if they contain any errors inside. In the event of an error, indicate how many characters are illegal, and show the original string with the illegal letters highlighted, for example show an error message of the following type:
Input contains error Error in String #1: aacgttcOgMa Error in String #2: ggataccaSat
Write this function in LCS.cpp which will validate the two input string X and Y respectively.It return true if both are valid DNA sequence; otherwise it returns false and print the relevant error information on screen.
LCS.cpp
#include "LCS.h" #include
using namespace std;
bool validate(string strX, string strY) {
}
LCS.h
#pragma once
#ifndef LCS_H
#define LCS_H
#include
using namespace std;
bool validate(string strX, string strY);
#endif
Assignment6.cpp (some more functions are included here which you can feel free to delete)
#include "LCS.h"
#include
#include
using namespace std;
//This function used to print the table contents
void printLengthTable(int** C, int m, int n);
void printArrowTable(char** B, int m, int n);
int main()
{
string strX, strY;
cout
cin >> strX;
cout
cin >> strY;
//validate the input two strings
if (validate(strX, strY) == false)
{
return 0;
}
int m = strX.length();
int n = strY.length();
//declare two dynamic 2-Dimensional array of variable length
//C is (m+1)X(n+1) and B is m X n
int** C;
char** B;
initLCSTable(&C, &B, m, n);
fillLCSTable(strX, strY, C, B);
cout
cout
cout
printLengthTable(C, m, n);
cout
printArrowTable(B, m, n);
freeLCSTable(C, B, m);
return 0;
}
Test example:
Input:
Output:
AACGTTCOGMA GGATACCASAT AACGTTCOGMA GGATACCASAT
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started