Minh Nguyen / Misc

Misc.cpp

Committer:
khaiminhvn
Date:
2021-03-12
Revision:
1:a46794267da5
Parent:
0:d30c0ebaea12
Child:
2:31917884f2d4

File content as of revision 1:a46794267da5:

#include "Misc.h"

//itos
string Misc::itos(int n){
    string tmp;
    char buffer[16];
    sprintf(buffer,"%d",n);
    tmp = buffer;
    
    return tmp;
}
string Misc::itos(int n, int w){
    string tmp;
    char buffer[16];
    sprintf(buffer,"%d",n);
    tmp = buffer;
    while(tmp.length() < w)
        tmp += " ";
    
    return tmp;
}