- HDD probléma (nem adatmentés)
- Azonnali fotós kérdések órája
- Monitortrió a Samsungtól, köztük egy 500 Hz-es QD-OLED-del
- Azonnali processzoros kérdések órája
- TCL LCD és LED TV-k
- AMD Ryzen 9 / 7 / 5 7***(X) "Zen 4" (AM5)
- Fujifilm X
- Fejhallgató erősítő és DAC topik
- Kormányok / autós szimulátorok topikja
- AMD Ryzen 9 / 7 / 5 / 3 5***(X) "Zen 3" (AM4)
Új hozzászólás Aktív témák
-
ZTE_luky
aktív 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!
- BESZÁMÍTÁS! Intel Core i9 9900K 8 mag 16 szál processzor garanciával hibátlan működéssel
- Lenovo ThinkPad T15 Gen 1 Intel Core i5-10310U
- ÁRGARANCIA!Épített KomPhone Ryzen 5 5600X 16/32/64GB RAM RX 7600 8GB GAMER PC termékbeszámítással
- ÁRGARANCIA!Épített KomPhone i5 10400F 16/32GB RAM RX 7600 8GB GAMER PC termékbeszámítással
- LG Gram 14 WUXGA IPS i7-1360P 5.0Ghz 12mag 32GB DDR5 1TB SSD Intel Iris XE 10óra Akku Win11 Garancia
Állásajánlatok
Cég: FOTC
Város: Budapest