- UNO での 予定は、未定
- UNO に itoaが無いので?
- 順番が逆
プログラム
#include <iostream>
using namespace std;
void myitoa(char *str,int num){
int m = 0;
if(num < 0){
num = 0 - num;
m = 1;
}
do{
*str++ = num % 10 + '0';
num /= 10;
}while(num != 0);
if(m == 1 ){
*str++ = '-';
}
*str = 0;
}
int main(void){
// Your code here!
char s[32];
myitoa(s,1234);
printf("%s\n",s);
myitoa(s,-1234);
printf("%s\n",s);
}
4321
4321-