I've been trying for 2 days now to get this code to work. It's just been error after error.
Can anyone point out what i'm doing wrong?
#include "stdafx.h"
#include <string>
#include <iostream>
using namespace std;
int main()
{
int h = 0;
for(int a = 100; a<1000; a++)
for(int b = 100; b<1000; b++)
int c = a * b;
// Error: "c" is undefined
if ((c == reverse(c)) && (c > h))
h = c;
cout << "The answer is: " << h << endl;
}
int reverse (int x)
{
// Error: "'itoa' : function does not take 1 arguments"
string s = string(itoa(x));
reverse(s.begin(), s.end());
return (x);
}
Using std::to_string just gives me more errors as well.