OvaS
Administrator

Data inscrierii: 29/Aug/2007 Mesaje: 68 Localitate: Calarasi |
|
Convertor 1337 ( cod sursa - C ) |
|
Converteste cuvinte in "limbajul 1337".
Code:
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#define RESET 0
#define BRIGHT 1
#define DIM 2
#define UNDERLINE 3
#define BLINK 4
#define REVERSE 7
#define HIDDEN 8
#define NEGRU 0
#define RED 1
#define GREEN 2
#define YELLOW 3
#define BLUE 4
#define MAGENTA 5
#define CYAN 6
#define WHITE 7
void textcolor(int attr, int fg, int bg);
int
main(int argc, char *argv[])
{
int i,c;
char *lower[26]={"4","8","©","|>","3","#","9","h","|","j","|<","1","m","n","0","|*","0","®","$","+","00","v","w",")(","j","2"};
char *upper[26]={"@","|3","(","|)","3","|=","6","-|","|","_|","|(","|_","M","N","0","|*","0.","|2","$","7","|_|","V","W","><","'/","2"};
char cuv[255];
textcolor(BRIGHT, RED, BLACK);
printf("nn [ !_30 ] prezents .. ");sleep(1);
textcolor(RESET, WHITE, BLACK);
textcolor(BRIGHT, GREEN, BLACK);
printf("1337 translator .. nnn");
textcolor(RESET, WHITE, BLACK);
textcolor(BRIGHT,BLUE,BLACK);
printf("Enter string : ");
textcolor(RESET, WHITE, BLACK);
textcolor(BLINK, RED, BLACK);
scanf("%s",&cuv);
textcolor(RESET, WHITE, BLACK);
printf("nn");
textcolor(BRIGHT, BLUE, REVERSE);
printf("Loading ...nn");
textcolor(RESET, WHITE, BLACK);
sleep(2);
textcolor(BRIGHT, WHITE, BLACK);
printf("Translated string : ");
textcolor(RESET, WHITE, BLACK);
textcolor(BRIGHT, YELLOW, BLINK);
for(i=0;i<strlen(cuv);++i)
{
c = toascii(cuv[i]);
if(( c >=97) && ( c <=122))
{
printf("%s ",lower[c-97]);
}
else
if ((c >=65) && ( c<=90))
{
printf("%s ",upper[c-65]);
}
else
printf("%c",cuv[i]);
}
textcolor(RESET, WHITE, BLACK);
printf("nnn");
textcolor(BRIGHT, CYAN, BLACK);
printf(" C programming 2006 nnn");
textcolor(RESET, WHITE, BLACK);
return 0;
}
void textcolor(int attr, int fg, int bg)
{
char command[13];
sprintf(command, "%c[%d;%d;%dm", 0x1B, attr, fg + 30, bg + 40);
printf("%s", command);
}
Have fun !
|
|