[an error occurred while processing this directive] [an error occurred while processing this directive]
Не уверен, что получится меньше, но ...
(«Телесистемы»: Конференция «Микроконтроллеры и их применение»)
[an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive]

Отправлено Kuka 04 февраля 2002 г. 21:51
В ответ на: Подскажите алгоритм отправлено Леонид Иванович 04 февраля 2002 г. 14:14

char index; //это то, что будет меняться
long value; //это сама переменная

long Inc(char index)
{
index++;
return expr(index);
}

long Dec(char index)
{
index--;
return expr(index);
}

long expr(char index)
{
long i;
switch(index%3)
{
case 0: i=1;break;
case 1: i=2:break;
case 2: i=5;break;
}
index/=3;
while(index--) i*=10;
return i;
}
Не очень красиво - зато без таблицы и операций с FP.


Составить ответ  |||  Конференция  |||  Архив

Ответы



Перейти к списку ответов  |||  Конференция  |||  Архив  |||  Главная страница  |||  Содержание  |||  Без кадра

E-mail: info@telesys.ru