This is very much a beginner thing, i dont know why this function doesnt check the if statment

the idea is to match a string with another string, and at the same time return true or false in order to keep the rest of the code checking to see if the pair is the same as the temppair, but putting cout in the if statement (if pair == temppair)proves its reading the code anyway, theres something fundemental i dont follow with if and else if though im not sure what it is



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
bool crackpair (string &pair, string &crack)
{

string temppair;
temppair = getrandpair ();
cout << temppair;

if (pair == temppair)
{
    cout << temppair;
   temppair = crack;
    return true;
}
else if(pair != temppair)
{
    return false;
}
}
Last edited on
BOOM its easy!
Topic archived. No new replies allowed.