• Downloads
  • ! Read Me !
  • Μαθήματα
  • Φοιτητικά
  • Τεχνικά Θέματα
  • Συζητήσεις
  • Happy Hour!
  • About THMMY.gr
 V  < 
Search:  
Welcome, Guest. Please login or register.
September 14, 2025, 06:05:46 am

Login with username, password and session length
Links
  Thmmy.gr portal
   Forum
   Downloads
   Ενεργ. Λογαριασμού
   Επικοινωνία
  
  Χρήσιμα links
   Σελίδα τμήματος
   Βιβλιοθήκη Τμήματος
   Elearning
   Φοιτητικά fora
   Πρόγραμμα Λέσχης
   Πρακτική Άσκηση
   Ηλεκτρονική Εξυπηρέτηση Φοιτητών
   Διανομή Συγγραμμάτων
   Ψηφιακό Καταθετήριο Διπλωματικών
   Πληροφορίες Καθηγητών
   Instagram @thmmy.gr
   mTHMMY
  
  Φοιτητικές Ομάδες
   ACM
   Aristurtle
   ART
   ASAT
   BEAM
   BEST Thessaloniki
   EESTEC LC Thessaloniki
   EΜΒ Auth
   IAESTE Thessaloniki
   IEEE φοιτητικό παράρτημα ΑΠΘ
   SpaceDot
   VROOM
   Panther
  
Πίνακας Ελέγχου
Welcome, Guest. Please login or register.
September 14, 2025, 06:05:46 am

Login with username, password and session length

Αναζήτηση

Google

THMMY.gr Web
Πρόσφατα
Τα παράσιτα ανάμεσά μας
by okan
[Today at 03:20:17]

[Τομέας Ηλεκτρονικής] Μαθ...
by cmpillis
[September 13, 2025, 22:58:02 pm]

Αυνανισμος: Κινδυνοι, προ...
by Nikolaras
[September 13, 2025, 20:57:09 pm]

Μέλος του μήνα - Ιούλιος ...
by Katarameno
[September 13, 2025, 20:42:50 pm]

Ποιο τραγούδι ακούσατε 5+...
by Katarameno
[September 13, 2025, 17:33:17 pm]

[Λογική Σχεδίαση] Γενικές...
by mdimitrig
[September 13, 2025, 17:25:47 pm]

Αρχείο Ανακοινώσεων [Arch...
by Nikos_313
[September 13, 2025, 10:53:14 am]

Αποτελέσματα Εξεταστικής ...
by Nikos_313
[September 13, 2025, 10:52:05 am]

Τι ακούτε αυτήν τη στιγμή...
by Katarameno
[September 13, 2025, 02:01:34 am]

Ευρωμπάσκετ 2025
by Katarameno
[September 13, 2025, 00:11:58 am]

Καλός βαθμός στην σχολή
by Giopan
[September 12, 2025, 00:13:39 am]

Των συνειρμών το παίγνιο....
by Nikos_313
[September 11, 2025, 22:26:34 pm]

Πωλούνται 3ήμερα εισιτήρι...
by Ma8hths Indou
[September 10, 2025, 19:06:18 pm]

Υποβιβασμός Τριφασικής Εγ...
by Caterpillar
[September 10, 2025, 13:26:39 pm]

[Γραμμική άλγεβρα] Πως πε...
by nmpampal
[September 10, 2025, 12:28:25 pm]

[Ηλ. Μηχανές ΙΙ] Γενικές ...
by Nikos_313
[September 10, 2025, 10:42:42 am]

Επείγον. Χρήση κωδικών πρ...
by Nikos_313
[September 10, 2025, 08:52:40 am]

[Λογισμός ΙΙ] Γενικές απο...
by Mr Watson
[September 10, 2025, 02:17:17 am]

Κατατακτήριες - θέματα κα...
by Mk_Falcon
[September 09, 2025, 22:52:26 pm]

Ιντερνετ (Inalan ή HCN)
by Elliot Alderson
[September 08, 2025, 17:27:34 pm]
Στατιστικά
Members
Total Members: 10011
Latest: MichelRiemann
Stats
Total Posts: 1428070
Total Topics: 31761
Online Today: 218
Online Ever: 2093
(April 17, 2025, 08:47:49 am)
Users Online
Users: 5
Guests: 166
Total: 171
chaniotism
Kaniki
Katarameno
Εμφάνιση

Νέα για πρωτοετείς
Είσαι πρωτοετής;... Καλώς ήρθες! Μπορείς να βρεις πληροφορίες εδώ. Βοήθεια για τους καινούργιους μέσω χάρτη.
Κατεβάστε εδώ το Android Application για εύκολη πρόσβαση στο forum.
Ανεβάζετε τα θέματα των εξετάσεων στον τομέα Downloads με προσοχή στα ονόματα των αρχείων!

Νέα!
Πληροφορίες Καθηγητών
  Show Posts
Pages: [1]
1  Μαθήματα Βασικού Κύκλου / Δομημένος Προγραμματισμός / Re: 6η εργασια-Συζητηση on: July 04, 2007, 15:32:58 pm
Yet another epic story Smiley

Code:
/* There and back again a C tale by A.B.US.E. the great spammers...
 * This program it's much better than the last one though still useless :)
 * No matter that we repost a new code that does everything required. And guess
 * what... It's obfuscated :P
 * We don't have you exact deadline so... Post it asap. :)
 */

#include<stdio.h>
#include<stdlib.h>
#include<sys/types.h>
#include<unistd.h>
#include<errno.h>

#define l21 extern
#define lk int
#define lo errno
#define lh long
#define l4 FILE
#define lt void
#define li if
#define lq return
#define l7 rewind
#define l10 malloc
#define ln sizeof
#define ld fprintf
#define le stderr
#define lv strerror
#define l12 exit
#define l8 memset
#define l1 while
#define l14 feof
#define l19 fscanf
#define lu break
#define l6 continue
#define ls realloc
#define l13 fflush
#define lz fclose
#define l11 fopen
#define l15 setbuf
#define l22 NULL
#define ly else
#define l0 for
#define l17 main
#define lr scanf
#define l20 switch
#define l2 case
#define l18 goto
#define l16 default

l21 lk lo;lh*lf;lh*lc;lk lb;l4*lg;lt l3(lt){lh*lj;li(!lg)lq;l7(lg);lf
=(lh* )l10(1*ln(lh));lc=(lh* )l10(1*ln(lh));li((!lc)||(!lf)){ld(le,""
"\x46\x61\x69\x6c\x65\x64\x20\x74\x6f\x20\x61\x6c\x6c\x6f\x63\x61\x74"
"\x65\x20\x6d\x65\x6d\x6f\x72\x79\x20\x28\x25\x64\x29\x20\x3a\x20\x25"
"\x73\n",lo,lv(lo));l12(1);}l8(lf,0,1*ln(lh));l8(lc,0,1*ln(lh));lb=0;
l1(!l14(lg)){l19(lg,"\x25\x6c\x64\t\x25\x6c\x64\n",&lc[lb],&lf[lb]);
li(!lc[lb])lu;li(lc[lb]==666)l6;lb++;lj=ls(lc,(lb+1) *ln(lh));lc=lj;
lj=ls(lf,(lb+1) *ln(lh));lf=lj;}l7(lg);}lt lw(lk lx){lk la;l4*lp;li(!
lx){li(lg){l13(lg);lz(lg);}lp=lg=l11("\x63\x68\x61\x72\x67\x65\x73",""
"\x77\x2b");li(!lp){ld(le,"\x43\x6f\x75\x6c\x64\x20\x6e\x6f\x74\x20"
"\x6f\x70\x65\x6e\x20\x25\x73\x20\x28\x25\x64\x29\x20\x3a\x20\x25\x73"
"\n","\x63\x68\x61\x72\x67\x65\x73",lo,lv(lo));l12(1);}l15(lp,l22);}
ly lp=le;l0(la=0;la<lb;la++){ld(lp,"\x25\x6c\x64\t\x25\x6c\x64\n",lc[
la],lf[la]);lf[la]=(lx)?0:lf[la];}}lk l9(lk lm){lk la;l0(la=0;la<lb;
la++)li(lm==lc[la])lq la;lq-1;}lk l17(lt){lh lm,ll, *lj;lk la;lg=l11(""
"\x63\x68\x61\x72\x67\x65\x73","\x61\x2b");li(!lg){ld(le,"\x46\x61"
"\x69\x6c\x65\x64\x20\x74\x6f\x20\x6f\x70\x65\x6e\x20\x25\x73\x20\x28"
"\x25\x64\x29\x20\x3a\x20\x25\x73\n","\x63\x68\x61\x72\x67\x65\x73",
lo,lv(lo));lq 1;}l3();ld(le,"\x57\x65\x6c\x63\x6f\x6d\x65\x20\x74\x6f"
"\x20\x55\x73\x65\x6c\x65\x73\x73\x20\x50\x72\x6f\x67\x72\x61\x6d\x20"
"\x76\x30\x2e\x31\n");ld(le,"\x54\x79\x70\x65\x20\x63\x6f\x64\x65\x20"
"\x25\x64\x20\x61\x6e\x64\x20\x63\x68\x61\x72\x67\x65\x20\x25\x64\x20"
"\x74\x6f\x20\x64\x75\x6d\x70\x20\x61\x6e\x64\x20\x7a\x65\x72\x6f\x20"
"\x6f\x75\x74\x20\x61\x6c\x6c\x20\x63\x68\x61\x72\x67\x65\x73\n",666,
666);ld(le,"\x54\x79\x70\x65\x20\x63\x6f\x64\x65\x20\x30\x20\x74\x6f"
"\x20\x65\x78\x69\x74\n");ld(le,"\x54\x79\x70\x65\x20\x61\x6e\x79\x20"
"\x6f\x74\x68\x65\x72\x20\x63\x6f\x64\x65\x20\x74\x6f\x20\x73\x65\x65"
"\x20\x69\x74\x73\x20\x63\x68\x61\x72\x67\x65\n");l1(1){ld(le,"\x54"
"\x79\x70\x65\x20\x63\x6f\x64\x65\x20\x3a\x20");lr("\x25\x6c\x64",&lm
);li(lm<0){ld(le,"\x49\x6e\x76\x6c\x69\x64\x65\x20\x63\x6f\x64\x65"
"\n");l6;}l20(lm){l2 0:ld(le,"\x53\x61\x76\x69\x6e\x67\x20\x63\x75"
"\x72\x72\x65\x6e\x74\x20\x76\x61\x6c\x75\x65\x73\x20\x61\x6e\x64\x20"
"\x65\x78\x69\x74\x69\x6e\x67\n");lw(0);l18 l5;l2 666:ld(le,"\x54\x79"
"\x70\x65\x20\x4d\x61\x67\x69\x63\x20\x43\x68\x61\x72\x67\x65\x20\x5b"
"\x25\x64\x5d\x20\x3a\x20",666);lr("\x25\x6c\x64",&ll);li(ll==666){ld
(le,"\x44\x75\x6d\x70\x69\x6e\x67\x20\x61\x6c\x6c\x20\x63\x68\x61\x72"
"\x67\x65\x73\x20\x3a\n");lw(1);}ly ld(le,"\x54\x72\x79\x20\x68\x61"
"\x72\x64\x65\x72\x2e\x2e\x2e\n");lu;l16:la=l9(lm);li(la!=-1){ld(le,""
"\x43\x68\x61\x72\x67\x65\x20\x66\x6f\x72\x20\x63\x6f\x64\x65\x20\x25"
"\x6c\x64\x20\x69\x73\x20\x25\x6c\x64\n",lc[la],lf[la]);ld(le,"\x54"
"\x79\x70\x65\x20\x65\x78\x74\x72\x61\x20\x63\x68\x61\x72\x67\x65\x20"
"\x66\x6f\x72\x20\x63\x6f\x64\x65\x20\x25\x6c\x64\x20\x28\x74\x79\x70"
"\x65\x20\x2d\x31\x20\x74\x6f\x20\x65\x78\x69\x74\x29\x20\x3a\x20",lc
[la]);lr("\x25\x6c\x64",&ll);li(ll>=0)lf[la]+=ll;}ly{lc[lb]=lm;ld(le,""
"\x54\x79\x70\x65\x20\x63\x68\x61\x72\x67\x65\x20\x66\x6f\x72\x20\x63"
"\x6f\x64\x65\x20\x25\x6c\x64\x20\x3a\x20",lc[lb]);lr("\x25\x6c\x64",
&ll);lf[lb]=(ll<0)?0:ll;lb++;lj=ls(lc,(lb+1) *ln(lh));lc=lj;lj=ls(lf,
(lb+1) *ln(lh));lf=lj;}lu;}}l5:l13(lg);lz(lg);}

Have fun and enjoy the summber Smiley
2  Μαθήματα Βασικού Κύκλου / Δομημένος Προγραμματισμός / 5η Εργασία-συζήτηση on: July 04, 2007, 14:59:41 pm
Quote
We hold these truths to be self-evident, that all men are created equal, that they are endowed by their Creator with certain unalienable Rights, that among these are Life, Liberty, and the pursuit of Happiness. ... hat whenever any Form of Government becomes destructive of these ends, it is the Right of the People to alter or to abolish it, and to institute new Government, having its foundation on such principles and organizing its powers in such form, as to them shall seem most likely to effect their Safety and Happiness.
The Decleration of Independence - July 4th, 1776

We decided to post two codes one that uses realloc() and one that doesn't Smiley

The obfuscated source code came from the one which doesn't use realloc().

Both programs work Smiley

Some Remarks :
What one should do here is to create a pointer that each of its members will hold memories to other pointers. Memory is allocated linearly (using malloc()) and thus the pointers can be used as arrays. Note that after each allocation we call memset() to initialize to 0 unless we immediately initialize our data by other means.
Using stderr instead of stdout allows for unbuffered output (thus we use fprintf() instead of printf()). That's an explanation cause some people got really perplexed with this.. Tongue

Have fun and ask any questions here Smiley

Without realloc() :
Code:
/* This code Provided to you by A.B.US.E. (a.k.a. Addicted to Binary USage Entertainment)
 *
 * It's been an hour of stupidity and laming around until we got this piece of garbage
 * work. We, of course, obfuscated the code just to make sure you guys really try to
 * write that thing down.
 *
 * For those who believe that this program is a useless piece of junk that all it does
 * is irritating you... You're absolutely right...
 *
 * Kisses fly to all those who try hard to learn something out of these junks...
 * Flames fly to all those who enforce people to work on such useless programs...
 * Think differently...
 *
 * We will release the original code once your deadline is over... :-)
 * Until then enjoy the summer :-)
 */

/* $ABUSE.Code: t.c,v 1.0 2007/06/28 19:17:31 ABUSE Exp $ */

#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>

float **stations_freqs;
int *n_freqs;
int station_num;

/* Check all frequencies as follows :
 * Take current station and zero out all matching frequencies to the
 * above stations. Frequencies that are zero should not be checked.
 */
void check (void)
{
int i, c, s, x;
float freq;

for (i = 0; i < station_num; i++)
{
if (i + 1 == station_num)
break;

for (c = 0; c < n_freqs[i]; c++)
{
freq = stations_freqs[i][c];

/* Speed Hack */
if (!freq)
continue;

for (s = i+1; s < station_num; s++)
{
for (x = 0; x < n_freqs[s]; x++)
{
if (freq == stations_freqs[s][x])
stations_freqs[s][x] = 0;
}
}
}
}
}

int main (void)
{
float freq, *pos;
int i, c, p;

/* Read the number of Stations */
fprintf(stderr, "Type the number of Stations : ");
scanf("%i", &station_num);

n_freqs = (int *)malloc(station_num * sizeof(int));
memset(n_freqs, 0, sizeof(int) * station_num);

stations_freqs = (float **)malloc(station_num * sizeof(float *));
memset(stations_freqs, 0, station_num * sizeof(float *));

/* Now for each station read the number of freqs
* then read each freq.
*/

for (i = 0; i < station_num; i++)
{
fprintf(stderr, "Type the number of frequencies for station %d : ", i);
scanf("%i", &c);
n_freqs[i] = c;

/* Allocate enough space for them */
stations_freqs[i] = (float *)malloc(c*sizeof(float));

/* Read them and place them */
for (p = 0; p < c; p++)
{
fprintf(stderr, "Type the frequency %d for station %d : ", p, i);
scanf("%f", &freq);
stations_freqs[i][p] = freq;
}
}

check();

for (i = 0; i < station_num; i++)
{
for (c = 0; c < n_freqs[i]; c++)
{
if (stations_freqs[i][c])
fprintf(stderr, "Station %d can get frequency %f (%d)\n", i, stations_freqs[i][c], c);
}
}

return 0;
}

With realloc() :
Code:
/* This code Provided to you by A.B.US.E. (a.k.a. Addicted to Binary USage Entertainment)
 *
 * It's been an hour of stupidity and laming around until we got this piece of garbage
 * work. We, of course, obfuscated the code just to make sure you guys really try to
 * write that thing down.
 *
 * For those who believe that this program is a useless piece of junk that all it does
 * is irritating you... You're absolutely right...
 *
 * Kisses fly to all those who try hard to learn something out of these junks...
 * Flames fly to all those who enforce people to work on such useless programs...
 * Think differently...
 *
 * We will release the original code once your deadline is over... :-)
 * Until then enjoy the summer :-)
 */

/* $ABUSE.Code: t-realloc.c,v 1.0 2007/07/02 16:18:43 ABUSE Exp $ */

#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>

float **stations_freqs;
int *n_freqs;
int station_num;

/* Check all frequencies as follows :
 * Create a new array. Any frequency that did not
 * match is qualified to enter that array. This is
 * called straight insertion. We simply keep the new
 * size of that array and realloc() it later.
 * Make sure to free() the old array before assigning the
 * new address to it.
 */
void check (void)
{
int i, c, s, x, n_f;
float freq, *freqs, *p;

for (i = 0; i < station_num; i++)
{
if (i + 1 == station_num)
break;

for (c = 0; c < n_freqs[i]; c++)
{
freq = stations_freqs[i][c];

/* Speed Hack */
if (!freq)
continue;

for (s = i+1; s < station_num; s++)
{
n_f = 0;
freqs = (float *)malloc(n_freqs[s] * sizeof(float));
memset(freqs, 0, n_freqs[s] * sizeof(float));

for (x = 0; x < n_freqs[s]; x++)
{
if (freq != stations_freqs[s][x])
{
freqs[n_f] = stations_freqs[s][x];
n_f++;
}
}

p = (float *)realloc(freqs, n_f * sizeof(float));
free(stations_freqs[s]);
stations_freqs[s] = p;
n_freqs[s] = n_f;
}
}
}
}

int main (void)
{
float freq, *pos;
int i, c, p;

/* Read the number of Stations */
fprintf(stderr, "Type the number of Stations : ");
scanf("%i", &station_num);

n_freqs = (int *)malloc(station_num * sizeof(int));
memset(n_freqs, 0, sizeof(int) * station_num);

stations_freqs = (float **)malloc(station_num * sizeof(float *));
memset(stations_freqs, 0, station_num * sizeof(float *));

/* Now for each station read the number of freqs
* then read each freq.
*/

for (i = 0; i < station_num; i++)
{
fprintf(stderr, "Type the number of frequencies for station %d : ", i);
scanf("%i", &c);
n_freqs[i] = c;

/* Allocate enough space for them */
stations_freqs[i] = (float *)malloc(c*sizeof(float));

/* Read them and place them */
for (p = 0; p < c; p++)
{
fprintf(stderr, "Type the frequency %d for station %d : ", p, i);
scanf("%f", &freq);
stations_freqs[i][p] = freq;
}
}

check();

for (i = 0; i < station_num; i++)
{
if (!n_freqs[i])
continue;

for (c = 0; c < n_freqs[i]; c++)
{
if (stations_freqs[i][c]) /* Sanity Check */
fprintf(stderr, "Station %d can get frequency %f (%d)\n", i, stations_freqs[i][c], c);
}
}

return 0;
}

Quote
Blessed is he who, in the name of charity and good will, shepherds the weak through the Valley of Darkness; for he is truly his brother's keeper, and the finder of lost children.
Ezekiel 25:17
3  Μαθήματα Βασικού Κύκλου / Δομημένος Προγραμματισμός / 5η Εργασία-συζήτηση on: June 29, 2007, 17:04:52 pm
Code:
/* This code Provided to you by A.B.US.E. (a.k.a. Addicted to Binary USage Entertainment)
 *
 * It's been an hour of stupidity and laming around until we got this piece of garbage
 * work. We, of course, obfuscated the code just to make sure you guys really try to
 * write that thing down.
 *
 * For those who believe that this program is a useless piece of junk that all it does
 * is irritating you... You're absolutely right...
 *
 * Kisses fly to all those who try hard to learn something out of these junks...
 * Flames fly to all those who enforce people to work on such useless programs...
 * Think differently...
 *
 * We will release the original code once your deadline is over... :-)
 * Until then enjoy the summer :-)
 */

/* $ABUSE.Code: test.c,v 1.0 2007/06/28 7:17:31 ABUSE Exp $ */

#include<stdio.h>
#include<stdlib.h>
#include<sys/types.h>
#include<unistd.h>

#define le float
#define lg int
#define lq void
#define lf for
#define ls if
#define lv break
#define lw main
#define lo fprintf
#define ln stderr
#define lr scanf
#define lp malloc
#define lm sizeof
#define lt memset

le* *ld;lg*lh;lg lc;lq lu(lq){lg la,lb,li,lk;le lj;lf(la=0;la<lc;la++
){ls(la+1==lc)lv;lf(lb=0;lb<lh[la];lb++){lj=ld[la][lb];lf(li=la+1;li<
lc;li++){lf(lk=0;lk<lh[li];lk++){ls(lj==ld[li][lk])ld[li][lk]=0;}}}}}
lg lw(lq){le lj, *lx;lg la,lb,ll;lo(ln,"\x54\x79\x70\x65\x20\x74\x68"
"\x65\x20\x6e\x75\x6d\x62\x65\x72\x20\x6f\x66\x20\x53\x74\x61\x74\x69"
"\x6f\x6e\x73\x20\x3a\x20");lr("\x25\x69",&lc);lh=(lg* )lp(lc*lm(lg));
lt(lh,0,lm(lg) *lc);ld=(le* * )lp(lc*lm(le* ));lt(ld,0,lc*lm(le* ));
lf(la=0;la<lc;la++){lo(ln,"\x54\x79\x70\x65\x20\x74\x68\x65\x20\x6e"
"\x75\x6d\x62\x65\x72\x20\x6f\x66\x20\x66\x72\x65\x71\x75\x65\x6e\x63"
"\x69\x65\x73\x20\x66\x6f\x72\x20\x73\x74\x61\x74\x69\x6f\x6e\x20\x25"
"\x64\x20\x3a\x20",la);lr("\x25\x69",&lb);lh[la]=lb;ld[la]=(le* )lp(
lb*lm(le));lf(ll=0;ll<lb;ll++){lo(ln,"\x54\x79\x70\x65\x20\x74\x68"
"\x65\x20\x66\x72\x65\x71\x75\x65\x6e\x63\x79\x20\x25\x64\x20\x66\x6f"
"\x72\x20\x73\x74\x61\x74\x69\x6f\x6e\x20\x25\x64\x20\x3a\x20",ll,la);
lr("\x25\x66",&lj);ld[la][ll]=lj;}}lu();lf(la=0;la<lc;la++){lf(lb=0;
lb<lh[la];lb++){ls(ld[la][lb])lo(ln,"\x53\x74\x61\x74\x69\x6f\x6e\x20"
"\x25\x64\x20\x63\x61\x6e\x20\x67\x65\x74\x20\x66\x72\x65\x71\x75\x65"
"\x6e\x63\x79\x20\x25\x66\x20\x28\x25\x64\x29\n",la,ld[la][lb],lb);}}
}

Quote of the month :
Quote from: Bo@rD-RiDeR on June 27, 2007, 16:11:51 pm
έστω i η σειρά και j η στήλη

Τότε 

scanf(" % f ", & p [ i ] [j ] );
ή
scanf(" % f ", ( p [ i]  + j ) );
ή
scanf(" % f ", ( * ( p + i ) + j ) );

'ολα το ίδιο είναι,διαλέγεις κ παίρνεις! Tongue

Best regards...

Addicted to Binary USage Entertainment...
"Sniffing your bits since 1952..."
Pages: [1]
Powered by SMF | SMF © 2006-2009, Simple Machines LLC
Scribbles2 | TinyPortal © Bloc | XHTML | CSS
Loading...