i am trying to make my program output values 10 or greater as the capitol letters of the alphabet, but i am having no luck, my code thus far is
Code:
void convert(vector<int>& rev_rems,int base,int num_div,vector<int>& rems)
{
int num;
int rem;
for(num=num_div;num!=0;num/=base)
{
rem=num%base;
rev_rems.push_back(rem);
}
for(rev_rems;rev_rems.size()!=0;rev_rems.pop_back())
{
rems.push_back(rev_rems[rev_rems.size()-1]);
}
}
void hex_convert(vector<int>& rems,vector<int>& rev_hex)
{
for(int i=0;i<rems.size();i++)
{
if(rems[i]>=10)
{
int x=rems[i]-10;
rev_hex.push_back(char(65+(x)));
}
else
{
rev_hex.push_back(rems[i]);
}
}
}
every time i try to make it output a letter it always spits out the number itself instead, when i try to get it to spit out the equivilent of 1,8,12 (285 base 13) it ends up spitting out 1,8,67, which if i could get it to display correctly 67 would be C. I have a feeling this problem is something obvious, but i just cannot seem to find it.