Well, and I don't know how you guys are able to write code without having an idea how to test it.
In your case I just slightly modified your main function to run through test cases:
int main()
{
int i=0;
int together, difference;
for (together=0; together<200; together++) {
for (difference=(together%2); difference<=together; difference+=2) {
memset(c,0,200);
memset(k,0,200);
memset(x,0,200);
a = to_string(together);
b = to_string(difference);
cout << "in: together: " << '\t' << together << endl;
cout << "in: difference: " << '\t' << difference << endl;
//for(i=0;i<10;i++)
//{
// cin>>a>>b;
addition();
}
}
}
This is only stupid code - I'm a noob with respect to C++ - but it works. The tabulated output allows me to copy past it into a spreadsheet and check the correctness there. And yes, there are false results