Mila kara
Paumata
Wikunaa
Wiriththana
Kuhakiynta
Hinawenawa
Hinawenawa
Man
Chasing the childhood dreams through the techno landscape. I refuse to give up!
/** main.cpp** Created on: 27 Jul 2009* Author: Osada*/#include#include#include#include "math.h"using namespace std;void process(fstream *input_file, fstream *output_file, int line_no){string num_str;string source_lang;string target_lang;string convert_num_str;char input_char = '\0';(*input_file) >> num_str >> source_lang >> target_lang;cout << "The number string is " <<>
cout <<>
cout <<>
/* Data processing variables set */long target_lang_dim = target_lang.size();long source_lang_dim = source_lang.size();long source_lang_value = 0;long pos_value = 0;long convert_residue = 0;std::reverse(num_str.begin(), num_str.end());for(int i =0; i <>
{pos_value = source_lang.find(num_str.at(i), 0);source_lang_value += pos_value * powl(source_lang_dim, i);}convert_residue = source_lang_value;ldiv_t div_result;while(convert_residue != 0){div_result = div(convert_residue, target_lang_dim);convert_residue = div_result.quot;convert_num_str.push_back(target_lang.at(div_result.rem));}std::reverse(convert_num_str.begin(), convert_num_str.end());(*output_file) << "Case #" <<>
}int main (int argc, char **argv){/* File input variables */fstream input_file("A-large-practice.in", fstream::in);fstream output_file("output.txt", fstream::out);int no_of_lines = 0;input_file >> no_of_lines;for(int i = 0; i
{process(&input_file, &output_file, (i + 1));}input_file.close();output_file.close();}