User Tools

Site Tools


tanszek:oktatas:szamitastechnika:operatorok

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
tanszek:oktatas:szamitastechnika:operatorok [2023/10/03 17:37] kneheztanszek:oktatas:szamitastechnika:operatorok [2024/10/29 19:46] (current) knehez
Line 38: Line 38:
 </code> </code>
  
-**4. Feladat:** Mi lesz az **e** változó értéke?+**4.Feladat:** Mi lesz az **e** változó értéke?
 <code c> <code c>
 #include <stdio.h> #include <stdio.h>
Line 48: Line 48:
     e = !( a <= b && !(c == d));     e = !( a <= b && !(c == d));
     printf("e = %d", e);     printf("e = %d", e);
 +}
 +</code>
 +
 +**4.b Feladat:** Mi lesz az **f** változó értéke?
 +<code>
 +#include <stdio.h>
 +
 +int main()
 +{
 +    int a = 5, b = 3, c = 8;
 +    int f;
 +    f = (a > b) || (c < a + b);
 +    printf("f = %d", f);
 +}
 +</code>
 +
 +**4.c Feladat:** Mi lesz az **z** változó értéke?
 +<code>
 +#include <stdio.h>
 +
 +int main()
 +{
 +    int x = 10, y = 7;
 +    int z;
 +    z = (x != y) && (y <= x) || !(x - y > 3);
 +    printf("z = %d", z);
 +}
 +</code>
 +
 +**4.d Feladat:** Mi lesz az k változó értéke?
 +<code>
 +#include <stdio.h>
 +
 +int main()
 +{
 +    int m = 4, n = 6;
 +    int k;
 +    k = !(m > n) && (m + n > 8) && (n - m == 2);
 +    printf("k = %d", k);
 } }
 </code> </code>
Line 104: Line 143:
 } }
 </code> </code>
 +
 +**7. az XOR-os titkosítás **
 +<code c>
 +#include <stdio.h>
 +
 +int main()
 +{
 +    // ha egy számot XOR-ozunk egy tetszőleges számmal 2x-akkor visszakapjuk az eredeti számot
 +    int value = 546356243;
 +    
 +    printf("%8b\n", value);
 +    
 +    int code = 112254534; 
 +    
 +    int encrypted = value ^ code;
 +    
 +    printf("%8b\n", encrypted);
 +    
 +    printf("%8b\n", encrypted ^ code);
 +    
 +    return 0;
 +}
 +</code>
 +
tanszek/oktatas/szamitastechnika/operatorok.1696354661.txt.gz · Last modified: 2023/10/03 17:37 by knehez