c++ using string in an if statement

Hey, I'm fairly new to c++ and i have been stuck on a bit of a problem.

#include <iostream>
#include <conio.h>
#include <algorithm>
#include <stdio.h>
#include <string>

using namespace std;
bool areAnagram(string str1, string str2);
bool count_letters(string str1, string str2);
string sort_word1(string str1);
string sort_word2(string str2);

void main(){
string word1;
string word2;

cout << "Please enter the first word " << endl;
cin >> word1;
cout << "Please enter the second word " << endl;
cin >> word2;
if(areAnagram(word1, word2)){
cout << word1 << "is an anagram of " << word2 << endl;
}
else{
cout << word1 << "Is not a anagram of " << word2 << endl;
}
_getch();
}

bool areAnagram(string str1, string str2){
cout << str1 << " " << str2 << endl;
string testing_word1 = sort_word1(str1);
string testing_word2 = sort_word2(str2);

if(testing_word1 = testing_word2){
return true;
}
else{
return false;
}
}

string sort_word1(string word1){
string sortedWord = word1;
sort(sortedWord.begin(), sortedWord.end());

return sortedWord;
}

string sort_word2(string word2){
string sortedword2 = word2;
sort(sortedword2.begin(), sortedword2.end());

return sortedword2;
}

i am basically making a program that sees if 2 words are anagrams
m errors are : expression must have bool type.

Error 1 error C2451: conditional expression of type 'std::basic_string<_Elem,_Traits,_Alloc>' is illegal

for this line only

if(testing_word1 = testing_word2)
= is assignment
== is equality
Well that is was easy thank you so much!
Topic archived. No new replies allowed.