I am working on flipping a string of numbers. I get no errors or warnings when compiling, but after I input numbers, there popped out an error window where I can understand none of the words. Can someone help me?
my purpose is:to see, in an interval of numbers, how many numbers have is the same when turned 180 degrees? (e.g.8888, 6699, 90088006)
Enviroment: OS: Windows 10, 64 bit
IDE: Visual studio community 2022
Error window:
code:
#include <iostream>
#include <string>
using namespace std;
int total = 0;
void numf(int n, string c) {
if (!(c.find('3') == 0 and c.find('4') == 0 and c.find('7') == 0 and
c.find('2') == 0 and c.find('5') == 0)) {
// reverse
string c2;
for (int i = 0; i < sizeof(c) / sizeof(c[0]); i++) {
c2[i] = c[sizeof(c) / sizeof(c[0]) - i - 1];
}
for (int i = 0; i < sizeof(c) / sizeof(c[0]); i++) {
if (c2[i] == '6') {
c2[i] = '9';
} else if (c2[i] == '9') {
c2[i] = '6';
}
}
if (c2 == c) {
total++;
}
}
return;
}
int main() {
int num, num2;
cin >> num >> num2;
for (int i = num; i <= num2; i++) {
string newnum = to_string(i);
numf(i, newnum);
}
cout << total;
return 0;
}