mirror of
https://github.com/arcan1s/moldyn.git
synced 2025-07-15 06:45:50 +00:00
+ added CMakeLists.txt
+ added headers + added library 'add_main.c' + some optimization
This commit is contained in:
23
statgen/int2char.c
Normal file
23
statgen/int2char.c
Normal file
@ -0,0 +1,23 @@
|
||||
/* Library for converting integer to string
|
||||
* Usage
|
||||
* char = conv (number, position)
|
||||
*/
|
||||
|
||||
|
||||
char conv (const int fnumb, const int dig_pos)
|
||||
/* fnumb - integer
|
||||
* dig_pos - position
|
||||
*/
|
||||
{
|
||||
int d, h, o;
|
||||
char const digit[] = "0123456789";
|
||||
|
||||
h = fnumb / 100;
|
||||
d = (fnumb % 100) / 10;
|
||||
o = fnumb % 10;
|
||||
|
||||
if (dig_pos == 1) return digit[o];
|
||||
if (dig_pos == 2) return digit[d];
|
||||
if (dig_pos == 3) return digit[h];
|
||||
else return digit[0];
|
||||
}
|
Reference in New Issue
Block a user