- Samsung Galaxy Watch8 - Classic - Ultra 2025
- Bemutatkozott a Poco X7 és X7 Pro
- Samsung Galaxy A35 5G - fordulópont
- Xiaomi 15T - reakció nélkül nincs egyensúly
- Hat év támogatást csomagolt fém házba a OnePlus Nord 4
- Apple iPhone 16 - ígéretek földje
- Huawei P40 Pro - kilökték a célegyenesben
- iPhone topik
- Huawei Watch GT 6 és GT 6 Pro duplateszt
- Milyen okostelefont vegyek?
Új hozzászólás Aktív témák
-
ZTE_luky
senior tag
Köszönöm szépen a segítséget, hát igen no [] tömböm random meg van határozva, de annál kevesebb értéket is kivehet mint a max, többet nem. Nem tudom az mennyire lehet probléma. Jelenleg se történik semmi, valami ilyesmit kellett kihozni az egészből 14:00-kor kell leadnom, de nem működik, tele van warning-al és nem is csinál semmi értelmeset sajnos. PEdig a kiinduló C-file gyönyörűen működik. Nem tudom mi lehet a baj, eléggé belekeveredtem sajnos.
#include<stdio.h>
#include<string.h>
// ---------- Globale Variablen ----------
int no[] = {0x0F,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,
0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F,0x20,0x21,0x22,
0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B};
// Address array
char string[9]; // String array
int R0; // (--int halt--) 0 Constant
int R1;
int R2; // (--int counter--) Index counter (String)
int R3; // (--int op--) Index Operation-Code
int R4; // (--int state--) Index strings
int R5; // (--int i--) Index counter (Address)
char R6; // (--char c--) Character to getchar
char R7; // (--char r1--) Register 1
char R8; // (--char r2--) Register 2
char R9; // (--char r3--) Register 3
int *RA; // (--int *no0--) BP of Address-array NEW
int *RB; // (--int *noi--) Flexibe Array Pointer NEW
char *RC; // (--char *string0--) BP of String-array NEW
char *RD; // (--char stringi--) Flexibe Array Pointer NEW
int RE; // SIZE 9
int RF; // FFFF
// ---------- Main Function ----------
int main()
{
R0 = 0;
R1 = 1;
R2 = 0;
R4 = 0;
R5 = 0;
RA = &no[0];
RC = &string[0];
RE = 9;
RF = 0xFFFF;
//no0 = &no[R0]; // Zero Element (in array "no") NEW
//string0 = &string[R0]; // Zero Element (in array "string") NEW
// ---------- Program ----------
L0: //init
R2 = R0; //counter
goto L1; //thestring;
L1: //thestring:
if (R2 < RE) // for (counter = 0; counter < 9 ;)
R6 = getchar(); //c
if ( R6 != EOF) //c
goto L2; //ignore;
else {goto L3;} //end
L2: //ignore:
if (R6 != 0x20 && R6 != 0xA) // R6=c
{
R2 += R1; //counter++;
//o++;
goto L1; //thestring;
}
// ---------- Search Function (Operating Code) ----------
// if (string[0] == 0x41 && string[1] == 0x44 && string[2] == 0x44)
if (*RC == 0x41 && *RC + R1 == 0x44 && *RC + R1 + R1 == 0x44) //NEW
{ //----- Function ADD -----
R3 = R1;
R4 += R1;
RB += R1;
R7 = RC + R1 * 4;
R8 = RC + R1 * 6;
R9 = RC + R1 * 8;
printf("%D:%d%c%c%c\n",RB,R3,R7,R8,R9); //Print the current string
}
//else if (string[0] == 0x53 && string[1] == 0x55 && string[2] == 0x42)
else if (*RC == 0x53 && *RC + R1 == 0x55 && *RC + R1 + R1 == 0x42)//NEW
{ //----- Function SUB -----
R3 = R1;
R4 += R1;
RB += R1;
R7 = RC + R1 * 4;
R8 = RC + R1 * 6;
R9 = RC + R1 * 8;
printf("%D:%d%c%c%c\n",RB,R3,R7,R8,R9); //Print the current string
}
//else if (string[0] == 0x41 && string[1] == 0x4E && string[2] == 0x44)
else if (*RC == 0x41 && *RC + R1 == 0x4E && *RC + R1 + R1 == 0x44) //NEW
{ //----- Function AND -----
R3 = R1;
R4 += R1;
RB += R1;
R7 = RC + R1 * 4;
R8 = RC + R1 * 6;
R9 = RC + R1 * 8;
printf("%D:%d%c%c%c\n",RB,R3,R7,R8,R9); //Print the current string
}
//else if (string[0] == 0x58 && string[1] == 0x4F && string[2] == 0x52)
else if (*RC == 0x58 && *RC + R1 == 0x4F && *RC + R1 + R1 == 0x52) //NEW
{ //----- Function XOR -----
R3 = R1;
R4 += R1;
RB += R1;
R7 = RC + R1 * 4;
R8 = RC + R1 * 6;
R9 = RC + R1 * 8;
printf("%D:%d%c%c%c\n",RB,R3,R7,R8,R9); //Print the current string
}
//else if (string[0] == 0x53 && string[1] == 0x48 && string[2] == 0x4C)
else if (*RC == 0x53 && *RC + R1 == 0x48 && *RC + R1 + R1 == 0x4C) //NEW
{ //----- Function SHL -----
R3 = R1;
R4 += R1;
RB += R1;
R7 = RC + R1 * 4;
R8 = RC + R1 * 6;
R9 = RC + R1 * 8;
printf("%D:%d%c%c%c\n",RB,R3,R7,R8,R9); //Print the current string
}
//else if (string[0] == 0x53 && string[1] == 0x48 && string[2] == 0x52)
else if (*RC == 0x53 && *RC + R1 == 0x48 && *RC + R1 + R1 == 0x52) //NEW
{ //----- Function SHR -----
R3 = R1;
R4 += R1;
RB += R1;
R7 = RC + R1 * 4;
R8 = RC + R1 * 6;
R9 = RC + R1 * 8;
printf("%D:%d%c%c%c\n",RB,R3,R7,R8,R9); //Print the current string
}
//else if (string[0] == 0x48 && string[1] == 0x4C && string[2] == 0x54)
else if (*RC == 0x48 && *RC + R1 == 0x4C && *RC + R1 + R1 == 0x54) //NEW
{ //----- Function HLT -----
R3 = R1;
R4 += R1;
RB += R1;
R7 = RC + R1 * 4;
R8 = RC + R1 * 6;
R9 = RC + R1 * 8;
printf("%D:%d%d%d%d\n",RB,R0,R0,R0,R0); //Print the current string
}
else printf("%04X\n", RF); //Print FFFF when it's an incorrct Value
goto L0; //init;
L3: //end
return 0;
}
Új hozzászólás Aktív témák
● olvasd el a téma összefoglalót!
● ha kódot szúrsz be, használd a PROGRAMKÓD formázási funkciót!
- Újszerű Acer Aspire A515 - 15.6"FHD IPS - i5-1335U - 16GB - 512GB SSD - Win11
- Nagyon kedvező áron!Eladó Synology DS923+ Alza Gari 2027.10.23-ig
- Karácsonyra ps4 / ps5 collectors edition és egyéb ritka játékok
- Kedvező Ár! MacBook Pro M1 Pro 14.2 Istyle gari 2026.07.27-ig
- Intel Core i9-9900K, Gigabyte Z390 AORUS Master, Noctua NH-D15
- Lenovo L14 Thinkpad Gen2 FHD IPS i5-1135G7 16GB RAM 256GB SSD Intel Iris XE Win11 Pro WiFi6 Garancia
- GYÖNYÖRŰ iPhone 13 mini 128GB Midnight -1 ÉV GARANCIA - Kártyafüggetlen, MS3315, 90% Akkumulátor
- BESZÁMÍTÁS! Microsoft XBOX Series X 1TB SSD fekete játékkonzol garanciával hibátlan működéssel
- HP 14 Elitebook 640 G10 FHD IPS i5-1345U vPro 10mag 16GB 512GB SSD Intel Iris XE Win11 Pro Garancia
- Új Fóliás Lenovo T14S Thinkpad FHD IPS i5-1135G7 16GB 512GB SSD Intel Iris XE Win11 Pro Garancia
Állásajánlatok
Cég: Promenade Publishing House Kft.
Város: Budapest
Cég: NetGo.hu Kft.
Város: Gödöllő



