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

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

Мой профиль
char str_in[128]="aaa#";

char str_out[128];

void main()
{
int len = 0;
for(int i=0; str_in[i]!='#';i++) {
if (str_in[i] == 'r'){
continue;
}
if (str_in[i] == 'a') {
str_out[len] = 'o';
len++;
continue;
}
str_out[len] = str_in[i];
len++;
}
}
Михаил Долинский

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

Мой профиль
char str_in[128]="qwerta#";

char str_out[128];

void main()
{
int len = 0;
for(int i=0; str_in[i]!='#';i++) {
if (str_in[i] == 'r'){
continue;
}
if (str_in[i] == 'a') {
str_out[len] = 'o';
len++;
continue;
}
str_out[len] = str_in[i];
len++;
}
}
Михаил Долинский

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

Мой профиль
int __in __bits(40) str_in;
int __out __bits(400) str_out;

void main()
{
int __bits(8) ch0;
int __bits(8) ch1;
int __bits(8) ch2;
int __bits(8) ch3;
int __bits(8) ch4;
int __bits(400) result;

ch0 = str_in & 255;
ch1 = (str_in >> 8) & 255;
ch2 = (str_in >> 16) & 255;
ch3 = (str_in >> 24) & 255;
ch4 = (str_in >> 32) & 255;

result = 0;

if (ch0 == '#') goto end;
if (ch0 == 'a' || ch0 == 'A') ch0 = 'o';
result = result | ch0;

if (ch1 == '#') goto end;
if (ch1 == 'a' || ch1 == 'A') ch1 = 'o';
result = result | (ch1 << 8);

if (ch2 == '#') goto end;
if (ch2 == 'a' || ch2 == 'A') ch2 = 'o';
result = result | (ch2 << 16);

if (ch3 == '#') goto end;
if (ch3 == 'a' || ch3 == 'A') ch3 = 'o';
result = result | (ch3 << 24);

if (ch4 == '#') goto end;
if (ch4 == 'a' || ch4 == 'A') ch4 = 'o';
result = result | (ch4 << 32);

end:
str_out = result;
}
Михаил Долинский

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

Мой профиль
int __in __bits(40) str_in;
int __out __bits(400) str_out;

void main()
{
int __bits(8) ch0;
int __bits(8) ch1;
int __bits(8) ch2;
int __bits(8) ch3;
int __bits(8) ch4;
int __bits(400) result;

ch0 = str_in & 255;
ch1 = (str_in >> 8) & 255;
ch2 = (str_in >> 16) & 255;
ch3 = (str_in >> 24) & 255;
ch4 = (str_in >> 32) & 255;

result = 0;

if (ch0 != '#')
{
if (ch0 == 'a' || ch0 == 'A') ch0 = 'o';
result = result | ch0;
}
else goto end;

if (ch1 != '#')
{
if (ch1 == 'a' || ch1 == 'A') ch1 = 'o';
result = result | (ch1 << 8);
}
else goto end;

if (ch2 != '#')
{
if (ch2 == 'a' || ch2 == 'A') ch2 = 'o';
result = result | (ch2 << 16);
}
else goto end;

if (ch3 != '#')
{
if (ch3 == 'a' || ch3 == 'A') ch3 = 'o';
result = result | (ch3 << 24);
}
else goto end;

if (ch4 != '#')
{
if (ch4 == 'a' || ch4 == 'A') ch4 = 'o';
result = result | (ch4 << 32);
}

end:
str_out = result;
}
Михаил Долинский

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

Мой профиль
int __in __bits(40) str_in;
int __out __bits(400) str_out;

void main()
{
int __bits(8) ch0;
int __bits(8) ch1;
int __bits(8) ch2;
int __bits(8) ch3;
int __bits(8) ch4;
int __bits(400) result;

ch0 = str_in & 255;
ch1 = (str_in >> 8) & 255;
ch2 = (str_in >> 16) & 255;
ch3 = (str_in >> 24) & 255;
ch4 = (str_in >> 32) & 255;

result = 0;

// ch0
if (ch0 == '#') goto end;
if (ch0 == 'a' || ch0 == 'A') ch0 = 'o';
result = ch0;

// ch1
if (ch1 == '#') goto end;
if (ch1 == 'a' || ch1 == 'A') ch1 = 'o';
result = result | (ch1 << 8);

// ch2
if (ch2 == '#') goto end;
if (ch2 == 'a' || ch2 == 'A') ch2 = 'o';
result = result | (ch2 << 16);

// ch3
if (ch3 == '#') goto end;
if (ch3 == 'a' || ch3 == 'A') ch3 = 'o';
result = result | (ch3 << 24);

// ch4
if (ch4 == '#') goto end;
if (ch4 == 'a' || ch4 == 'A') ch4 = 'o';
result = result | (ch4 << 32);

end:
str_out = result;
}
Михаил Долинский

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

Мой профиль
int __in __bits(40) str_in;
int __out __bits(400) str_out;

void main()
{
int __bits(400) result;
int __bits(8) ch;
int __bits(3) pos_in;
int __bits(6) pos_out;

result = 0;
pos_in = 0;
pos_out = 0;

while (pos_in < 5)
{
ch = (str_in >> (pos_in * 8)) & 255;

if (ch == '#') break;

if (ch == 'g' || ch == 'G')
{
// TГ¦+¦-¦¬TП¦¦¦- g ¦¬ G тАФ ¦¬TА¦-¦¬TГTБ¦¦¦-¦¦¦-
}
else
{
if (ch == 'a' || ch == 'A')
{
ch = 'o';
}

result = result | (ch << (pos_out * 8));
pos_out = pos_out + 1;
}

pos_in = pos_in + 1;
}

str_out = result;
}
Михаил Долинский

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

Мой профиль
int __in __bits(400) str_in;
int __out __bits(400) str_out;

void main()
{
int __bits(400) result;
int __bits(8) ch;
int __bits(6) i;

result = 0;
i = 0;

while (i < 50)
{
ch = (str_in >> (i * 8)) & 255;

if (ch == '#') break;

if (ch == 'g' || ch == 'G')
{
ch = 0;
}

result = result | (ch << (i * 8));

i = i + 1;
}

str_out = result;
}
Михаил Долинский

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

Мой профиль
char __in __bits(8) str_in[50];
char __out __bits(8) str_out[50];

void main()
{
int __bits(8) i;
int __bits(8) j;
char __bits(8) ch;

i = 0;
j = 0;

while (1)
{
ch = str_in[i];

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

if (ch == 'r')
{
/* ¦¬TА¦-¦¬TГTБ¦¦¦-¦¦¦- TБ¦¬¦-¦-¦-¦¬ */
}
else if (ch == 'a')
{
str_out[j] = 'o';
j = j + 1;
}
else
{
str_out[j] = ch;
j = j + 1;
}

i = i + 1;
}
}
Михаил Долинский

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

Мой профиль
char str_in[100];
char str_out[100];

void main(){
int i = 0, ii = 0;
while(str_in[i]!='#'){
if(str_in[i]=='a'){
str_out[ii] = 'o';
i++;
ii++;
} else if (str_in[i]!='r'){
str_out[ii] = str_in[i];
i++;
ii++;
}
}
}
Михаил Долинский

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

Мой профиль
char str_in[100];
char str_out[100];

void main(){
int i = 0, ii = 0;
while(str_in[i]!='#'){
if(str_in[i]='a'){
str_out[ii] = 'o';
i++;
ii++;
} else if (str_in[i]!='r'){
str_out[ii] = str_in[i];
i++;
ii++;
}
}
}
Михаил Долинский

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

Мой профиль
char str_in[100];
char str_out[100];

void main(){
int i = 0, ii = 0;
while(str_in[i]!='#'){
if(str_in[i]='a'){
str_out[ii] = 'o';
i++;
ii++;
} else if (str_in[i]!='r'){
str_out[ii] = str_in[i];
i++;
ii++;
}
}
}
Михаил Долинский

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

Мой профиль
char str_in[50];

char str_out[50]

void main() {
char res[50];
int fp = 0;
int sp = 0;
int i = 0;
for(i = 0; str_in[i] != '#'; i++) {
if(str_in[fp] == 'a') {
str_out[sp] = 'o';
sp++;
fp++;
}
else if(str_in[fp] == 'r') {
fp++;
}
else {
str_out[sp] = str_in[fp];
sp++;
fp++;
}
}

}
Михаил Долинский

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

Мой профиль
char str_in[50];

char str_out[50];


void main()
{
int fp = 0;
int sp = 0;

for(int i = 0; str_in[i] != '#'; i++){
if(str_in[fp] == 'r') {
continue;
}
else if(str_in[fp] == 'a') {
str_out[sp] = 'o';
}
else {
str_out[sp] = str_in[fp];
sp++;
}
fp++;
}
}
Михаил Долинский

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

Мой профиль
char str_in[50];

char str_out[50];


void main()
{
int fp = 0;
int sp = 0;

for(int i = 0; str_in[i] != '#'; i++){
if(str_in[fp] == 'r') {
continue;
}
else if(str_in[fp] == 'a') {
str_out[sp] = 'o';
}
else {
str_out[sp] = str_in[fp];
sp++;
}
fp++;
}
}
Михаил Долинский

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

Мой профиль
char str_in[256];
char str_out[256];

void main() {
int j = 0;
for (int i = 0; str_in[i]!='#';i++) {
if (str_in[i]!='r') {
if (str_in[i]=='a') {
str_out[j]='o';
} else {
str_out[j]=str_in[i];
}
j++;
}
}
}
 
Индекс форума ->Учебный процесс ГГУ/СШ 27 ->Проектирование цифровых систем 1, 2
Time:0,014