The implement pointers in the code

computer science

Description


Below is the code i've got so far. I can't figure out how to implement pointers in the code and cant figure out how to create the Calculate Best Match function as denoted in the attachment. Need help making that function, and implementing pointers. please make sure to comment.
#include <iostream>
#include <functional>
#include <numeric>
#include <string.h>
using namespace std;
// function declaration
void compare string Similarity(string s1, string s2, int status);
int main()
{
cout << "Enter string 1n";
string s1;
getline(cin, s1);
cout << "Enter string 2 (of the same length)n";
string s2;
getline(cin, s2);
if(s1.size() == s2.size()){
cout << "The Hamming distance is ";
int diffs =inner_product(s1.begin(), s1.end(), s2.begin(), 0,plus<int>(), not_equal_to<char>());
cout<< diffs<<'n';}
else
cout << "The length of the strings entered is not equaln";
//using compare string Similarity(string s1, string s2, int status) function
int status;
compare string Similarity(s1,s2,status);
if(status==1)
   cout<<" Two strings are equal."<<endl;
else
   cout<<"Two strings are not equal."<<endl;
return 0;
}
// function definition
void compare string Similarity(string s1, string s2, int status){
if(s1.size() != s2.size()){ // strings are not similar
status = 0; // storing false value
return;
}
unsigned int i=0, j=0;
while(i<s1.size()){
if(s1.at(i) != s2.at(j)){ // current character is not equal
status = 0;
return;
}
i++;
j++;
}
// we reach here, means both strings are equal
status = 1;
}

void 

Download Attachment: 
Assignment4_DNA.pdf

Attachments area


Related Questions in computer science category