I writed program to convert a number of cell and row to excel data. Here is code:
#include <cstdlib>
#include <iostream>
using namespace std;
char dgt[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int input = 10;
int output = 26;
int main() {
char name[64];
std::cin.getline(name, 64);
string text = name;
char* temp;
int spacja = text.find(' ');
long liczba = strtol(text.substr(spacja+1,text.size()).c_str(), &temp, input);
string out = "";
liczba--;
for (int i = 32; true; i--) {
out = dgt[liczba % output - (i==32?0:1)] + out;
liczba = liczba / output;
if (liczba <= 0)
break;
}
cout << out << text.substr(0,spacja);
return 0;
}
I got 90/100, in one test it's return bad value. Where is error? I cannot check it.