[Logo] Форум DL
  [DL]  На главную страницу 
Индекс форума ->Учебный процесс ГГУ/СШ 27 ->Проектирование цифровых систем 1, 2
Автор Сообщение
Михаил Долинский

Темы: 2184
Сообщений: 52607

Мой профиль
char in_str[20]="q1w2*231";
int __out __bits(8) res;

void main() {
res = 0;
int i = 0;
while (in_str[i] != '*') res++;
}
Михаил Долинский

Темы: 2184
Сообщений: 52607

Мой профиль
char in_str[128];

unsigned __out __bits(8) res;

void main() {
unsigned __bits(8) kol = 0;

for (unsigned __bits(16) i = 0; in_str[i] != '*'; i++) {
if (in_str[i] >= '0' && in_str[i] <= 9) {
kol++;
}
}
res = kol;
}
Михаил Долинский

Темы: 2184
Сообщений: 52607

Мой профиль
char in_str[128];

unsigned __out __bits(16) res;

void main() {
unsigned __bits(16) kol = 0;

for (unsigned __bits(16) i = 0; in_str[i] != '*'; i++) {
if (in_str[i] >= '0' && in_str[i] <= 9) {
kol++;
}
}
res = kol;
}
Михаил Долинский

Темы: 2184
Сообщений: 52607

Мой профиль
int __in __bits(48) in_str;
int __out __bits(8) res;

void main()
{
int __bits(48) str;
int __bits(8) count;
int __bits(8) i;
int __bits(8) ch;

str = in_str;
count = 0;
i = 0;

while (i < 6)
{
ch = str & 255;

if (ch == 0) break;

if (ch >= '0' && ch <= '9')
{
count = count + 1;
}

if (ch == '*')
{
break;
}

str = str >> 8;
i = i + 1;
}

res = count;
}
Михаил Долинский

Темы: 2184
Сообщений: 52607

Мой профиль
int __in __bits(64) in_str;
int __out __bits(8) res;

void main()
{
int __bits(64) str;
int __bits(8) count;
int __bits(8) i;

str = in_str;
count = 0;
i = 0;

while (i < 8)
{
int __bits(8) ch;
ch = str & 255;

if (ch == 0) break;

if (ch >= '0' && ch <= '9')
{
count = count + 1;
}

if (ch == '*')
{
break;
}

str = str >> 8;
i = i + 1;
}

res = count;
}
Михаил Долинский

Темы: 2184
Сообщений: 52607

Мой профиль
int __in __bits(64) in_str(db);
int __out __bits(8) res(db);

void main()
{
int __bits(64) str;
int __bits(8) count;
int __bits(8) i;

str = in_str;
count = 0;
i = 0;

while (i < 64)
{
int __bits(8) ch;
ch = str & 255;

if (ch == 0) break;

if (ch >= '0' && ch <= '9')
{
count = count + 1;
}

if (ch == '*')
{
break;
}

str = str >> 8;
i = i + 1;
}

res = count;
}
Михаил Долинский

Темы: 2184
Сообщений: 52607

Мой профиль
char in_str[32];
int __out __bits(8) res;

void main() {
int len = 0;
int i;

if (in_str[len] != '#') {
len++;
}

for (i=0; i<len; i++) {
if (in_str[len] != '*' && in_str[len] == '1','2','3','4','5','6','7','8','9','0') {
res++;
}
else break;
}
}
Михаил Долинский

Темы: 2184
Сообщений: 52607

Мой профиль
char __bits(8) in_str[32];
int __bits(8) res;

void main() {

for (int i = 0; in_str[i] != '*'; i++){
if (in_str[i] == 1 || in_str[i] == 2 || in_str[i] == 3 || in_str[i] == 4 || in_str[i] == 5 || in_str[i] == 6 || in_str[i] == 7 || in_str[i] == 8 || in_str[i] == 9 || in_str[i] == 0){
res++;
}
}


}
 
Индекс форума ->Учебный процесс ГГУ/СШ 27 ->Проектирование цифровых систем 1, 2
Time:0,023