Programming Freaks  | دورات ومقالات برمجيه

Please login or register.

Login with username, password and session length
Advanced search  

News:

Please Read our FAQ

Author Topic: Try to do this  (Read 819 times)

St0rM

  • [C programmer]
  • Administrator
  • Active Member
  • *****
  • Posts: 209
  • Why So serious ?
    • View Profile
    • WWW
    • Email
Try to do this
« on: April 22, 2009, 03:20:08 PM »
i did this in almost 5 minutes I KNOW if i had spent more time i would make things even more complicated than i would even know , its in my nature  :P
any way figure it  out without compiling the program

Code: [Select]
#include <stdio.h>
_main(__ ,  ______ ,  _______)const char *__;{int ___ = ______;int ____ = _______;while(____ == _______){char _____ = __[___];
                _____ == ' ' ? putchar(_____) : putchar(++_____);(__[___] == '\0') ? ____ = ______ : ___++;(____ == ______) ? (____ = ______) : (____  = _______);}return ______;}main(){_main("etbj xnt vnqkc",0,1);putchar('\n');return 0;}


yeah its a legal c code :P
in 5 minutes , can you do something like this ? its a challenge  :P

Code: [Select]
gcc -ansi cop.c -o st
« Last Edit: April 22, 2009, 03:34:14 PM by St0rM »
Logged

i-control

  • Just Joined
  • *
  • Posts: 14
  • Let Us C
    • View Profile
Re: Try to do this
« Reply #1 on: May 05, 2009, 05:20:02 AM »
تمام اوى عجبتنى الفكره انا مفهمتش حاجه من الكود
وهو ده اللى انت عاوزه اعتقد كده  :D
بس عموما الجمله اللى انت حطيتها زودت على كل حرف فى الاسكى بتاعها واحد
  وهو ده كل اللى انا فهمته
طيب انا قلت احط كود كده عملته زمان لما كنت بتعلم سى
طبعا هو مقروء جدا ومفهوم جدا بس دا اكبر سورس كتبته لحد النهارده
لأنى كنت وقفت شويه فى حكايه البرمجه بالسى زى ما قلت
عموما الكود اهو خلينا نتناقش شويه انا عاوز بقى اعرف ايه عيوبه واتفاداها ازاى وكده

Code: [Select]
/*
         Name:     bt2final.c
    Copyright:     gpl2
       Author:     ahmed samer
         Date:     13/09/08 8:20
  Description:     i'm trying to learn macros
*/

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
void line2(void);
main()
{
      char usr[4],pas[4];
      printf("\n");
      line2();
      printf("\nWellcome to BackTrack v.2.0 Final\n");
      line2();
      printf("\n\nthe system is up and running now.");
      printf("\n\nlogin as \"root\", with password \"toor\", both without quotes, lowercase.");
      printf("\n\n\nAfter you login, try the following commands:");
      printf("\n\nstartx ... to run Xwindow system in VISA mode 1024×768 at 75Hz");
      printf("\nflux   ... the same like startx but use FluxBoxinstead ok KDE");
      printf("\nxconf  ... to autoconfigure your graphics card for better performance");
      printf("\nati    ... to autoconfigure ati drivers (download ati.lzm required)");
      printf("\nOther commands you may find useful (for experts only!):");
      printf("\n\n\nconfigsave/configrestore ... to save and restore all filesystem changes");
      printf("\nfileswap .... to create special for swapping RAM to your harddisk");
      printf("\n\nWhen finished , use \"poweroff\" or \"reboot\" command and wait untilit completes\n");
      line2();
      do
      {
      printf("\n\nbt login: ");
      scanf("%s",&usr);
      }
      while(strcmp(usr,"root")!=0);
      do
      {
      printf("\n\nbt pass: ");
      scanf("%s",&pas);
      }
      while(strcmp(pas,"toor")!=0);
      printf("\n\n\t\twellcome to my world ;)\n\n");
      }

void line2(void)
{
     int i;
     for(i=0;i<70;i++)
      printf("=");
}


Logged
#include<stdio.h>
main()
{
printf("hello , PF\n");
}

St0rM

  • [C programmer]
  • Administrator
  • Active Member
  • *****
  • Posts: 209
  • Why So serious ?
    • View Profile
    • WWW
    • Email
Re: Try to do this
« Reply #2 on: May 05, 2009, 05:43:32 AM »
ولونه ملوش اي علاقه بموضوعنا بس ماشي    :D
الكود في عيب بسيط , scanf
مشكلتها انها مش بتاخد ال \n الي بتتكتب في اخر السطر لما بتتك enter وبالتالي بتتخزن في ال buffer وده بينتج عنه ان الاستدعاء الجاي ل scanf حياخد ال \n وده حيسبب فشل في الشرط

مثال
Code: [Select]
scanf("%s",name);
scanf("%s",last_name);

ده حيسبب ان ال last_name مش هيكون فيه اي بيانات غير \n
حلها بسيط استخدم fgets or getchar after scanf

Logged

i-control

  • Just Joined
  • *
  • Posts: 14
  • Let Us C
    • View Profile
Re: Try to do this
« Reply #3 on: May 05, 2009, 06:01:00 AM »
يعنى المشكله دى مش بتظهر غير لما
احط اتنين
scanf
ورا بعض زى فى المثال
Code: [Select]
scanf("%s",name);
scanf("%s",last_name);
انما لو بعيد مش هايحصل المشكله دى ولا هى هى نفس المشكله
Logged
#include<stdio.h>
main()
{
printf("hello , PF\n");
}

St0rM

  • [C programmer]
  • Administrator
  • Active Member
  • *****
  • Posts: 209
  • Why So serious ?
    • View Profile
    • WWW
    • Email
Re: Try to do this
« Reply #4 on: May 05, 2009, 06:15:15 AM »
lol no no
its a sequence , a sequence of statments
got nothing to do with source code style
Logged