Hello,
I have a problem where I need to call the function matchexact() passing the two strings. matchexact() will determine how many times the corresponding positions in the two strings hold exactly the same characters. The function will print this value.
For example, if the two strings are "marriage" and "gerbil", then the function matchexact will return 2, since the two strings have the same characters in positions 2 and 5.
then I need a function that joins two string into one:
The main program will then call a function jointhem() which receives the two strings. The function will join the two strings together and print the new string. Ex. if string1 is “bath” and string2 is “water” than the new string is “bathwater”

Here's my code for matching characters in strings but it doesnt work or maybe its not even being properly called from main.
Can someone please tell me what is the proper way to do this?

Code:
void matchexact(string first, string second){
     int count = 0;
     for (int i = 0; i < second.length(); i++){
         if (first[i] == second[i]){
                      count++;
                      }
     }
cout << "count: " << count << endl;
return;
}
The function that joins 2 strings when it is called from main doesnt work (it only works if I put this function into mathexact() function.)
Here it is:
Code:
void jointhem(string first, string second){
      string concate
      concate = first + second;
      cout << concate << endl;
return;
}
Here's my full code:
Code:
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
void makewords(string ,string ,string);
void matchexact(string, string);
void jointhem(string, string); 
int main (){  
     string phrase, first, second;   
     makewords(phrase, first ,second);
     matchexact(first, second);
     jointhem(first , second);
     system("pause");
}     
void makewords(string ,string ,string){
     int pos, pos2, firstsize, secondsize;
     string phrase, first, second;
     getline(cin,phrase);
     pos = phrase.find(" ", 0);
     first = phrase.substr(0,pos);
     second = phrase.substr(pos+1);
     firstsize = first.length();
     secondsize = second.length();
                if (firstsize == secondsize){
                   cout << "These strings are equal \n";
                }else{
                   cout << "These strings are not equal \n";      
}
cout << "string: " << first << "  size: " << firstsize << endl;
cout << "string: " << second << "  size: " << secondsize << endl;
return;
}
void matchexact(string first, string second){
     int count = 0;
     for (int i = 0; i < 4; i++){
         if (first[i] == second[i]){
            count++;
         }
     }
cout << "count: " << count << endl;
return;
}
void jointhem(string first, string second){
      string concate;
      concate = first + second;
      cout << concate << endl;
return;
}
Please help me put this together. Thank you.