| QUOTE |
| That's just as impossible as finding the last reflection of two paralell mirrors. |
| QUOTE |
| unless you knew about how assembly language worked real good then you could display the REAL asm source of your program. other than that... |
| CODE |
| #include <stdio.h> int main(void){char*s="#include <stdio.h>%cint main(void){char*s=%c%s%c;printf(s,10,34,s,34,10);return(0);}%c";printf(s,10,34,s,34,10);return(0);} |
| CODE |
| bits 16 org 256 mov ah,64 mov bx,1 mov cx,720 mov dx,b+16 int 33 mov cx,90 mov si,b+16 c:push cx mov ah,64 mov bx,1 mov cx,6 mov dx,b int 33 mov cx,7 a:push cx mov al,[si] shr al,4 add al,48 cmp al,58 jb g add al,39 g:mov [b+8],al lodsb and al,15 add al,48 cmp al,58 jb e add al,39 e:mov [b+9],al mov ah,64 mov bx,1 mov cx,5 mov dx,b+6 int 33 pop cx loop a mov al,[si] shr al,4 add al,48 cmp al,58 jb h add al,39 h:mov [b+8],al lodsb and al,15 add al,48 cmp al,58 jb n add al,39 n:mov [b+9],al mov ah,64 mov bx,1 mov cx,4 mov dx,b+6 int 33 pop cx loop c mov ah,64 mov bx,1 mov cx,5 mov dx,b+11 int 33 mov ah,76 int 33 b db 13,10,' db 0x ,',13,10,'end' db 0x62,0x69,0x74,0x73,0x20,0x31,0x36,0x0d db 0x0a,0x6f,0x72,0x67,0x20,0x32,0x35,0x36 db 0x0d,0x0a,0x6d,0x6f,0x76,0x20,0x61,0x68 db 0x2c,0x36,0x34,0x0d,0x0a,0x6d,0x6f,0x76 db 0x20,0x62,0x78,0x2c,0x31,0x0d,0x0a,0x6d db 0x6f,0x76,0x20,0x63,0x78,0x2c,0x37,0x32 db 0x30,0x0d,0x0a,0x6d,0x6f,0x76,0x20,0x64 db 0x78,0x2c,0x62,0x2b,0x31,0x36,0x0d,0x0a db 0x69,0x6e,0x74,0x20,0x33,0x33,0x0d,0x0a db 0x6d,0x6f,0x76,0x20,0x63,0x78,0x2c,0x39 db 0x30,0x0d,0x0a,0x6d,0x6f,0x76,0x20,0x73 db 0x69,0x2c,0x62,0x2b,0x31,0x36,0x0d,0x0a db 0x63,0x3a,0x70,0x75,0x73,0x68,0x20,0x63 db 0x78,0x0d,0x0a,0x6d,0x6f,0x76,0x20,0x61 db 0x68,0x2c,0x36,0x34,0x0d,0x0a,0x6d,0x6f db 0x76,0x20,0x62,0x78,0x2c,0x31,0x0d,0x0a db 0x6d,0x6f,0x76,0x20,0x63,0x78,0x2c,0x36 db 0x0d,0x0a,0x6d,0x6f,0x76,0x20,0x64,0x78 db 0x2c,0x62,0x0d,0x0a,0x69,0x6e,0x74,0x20 db 0x33,0x33,0x0d,0x0a,0x6d,0x6f,0x76,0x20 db 0x63,0x78,0x2c,0x37,0x0d,0x0a,0x61,0x3a db 0x70,0x75,0x73,0x68,0x20,0x63,0x78,0x0d db 0x0a,0x6d,0x6f,0x76,0x20,0x61,0x6c,0x2c db 0x5b,0x73,0x69,0x5d,0x0d,0x0a,0x73,0x68 db 0x72,0x20,0x61,0x6c,0x2c,0x34,0x0d,0x0a db 0x61,0x64,0x64,0x20,0x61,0x6c,0x2c,0x34 db 0x38,0x0d,0x0a,0x63,0x6d,0x70,0x20,0x61 db 0x6c,0x2c,0x35,0x38,0x0d,0x0a,0x6a,0x62 db 0x20,0x67,0x0d,0x0a,0x61,0x64,0x64,0x20 db 0x61,0x6c,0x2c,0x33,0x39,0x0d,0x0a,0x67 db 0x3a,0x6d,0x6f,0x76,0x20,0x5b,0x62,0x2b db 0x38,0x5d,0x2c,0x61,0x6c,0x0d,0x0a,0x6c db 0x6f,0x64,0x73,0x62,0x0d,0x0a,0x61,0x6e db 0x64,0x20,0x61,0x6c,0x2c,0x31,0x35,0x0d db 0x0a,0x61,0x64,0x64,0x20,0x61,0x6c,0x2c db 0x34,0x38,0x0d,0x0a,0x63,0x6d,0x70,0x20 db 0x61,0x6c,0x2c,0x35,0x38,0x0d,0x0a,0x6a db 0x62,0x20,0x65,0x0d,0x0a,0x61,0x64,0x64 db 0x20,0x61,0x6c,0x2c,0x33,0x39,0x0d,0x0a db 0x65,0x3a,0x6d,0x6f,0x76,0x20,0x5b,0x62 db 0x2b,0x39,0x5d,0x2c,0x61,0x6c,0x0d,0x0a db 0x6d,0x6f,0x76,0x20,0x61,0x68,0x2c,0x36 db 0x34,0x0d,0x0a,0x6d,0x6f,0x76,0x20,0x62 db 0x78,0x2c,0x31,0x0d,0x0a,0x6d,0x6f,0x76 db 0x20,0x63,0x78,0x2c,0x35,0x0d,0x0a,0x6d db 0x6f,0x76,0x20,0x64,0x78,0x2c,0x62,0x2b db 0x36,0x0d,0x0a,0x69,0x6e,0x74,0x20,0x33 db 0x33,0x0d,0x0a,0x70,0x6f,0x70,0x20,0x63 db 0x78,0x0d,0x0a,0x6c,0x6f,0x6f,0x70,0x20 db 0x61,0x0d,0x0a,0x6d,0x6f,0x76,0x20,0x61 db 0x6c,0x2c,0x5b,0x73,0x69,0x5d,0x0d,0x0a db 0x73,0x68,0x72,0x20,0x61,0x6c,0x2c,0x34 db 0x0d,0x0a,0x61,0x64,0x64,0x20,0x61,0x6c db 0x2c,0x34,0x38,0x0d,0x0a,0x63,0x6d,0x70 db 0x20,0x61,0x6c,0x2c,0x35,0x38,0x0d,0x0a db 0x6a,0x62,0x20,0x68,0x0d,0x0a,0x61,0x64 db 0x64,0x20,0x61,0x6c,0x2c,0x33,0x39,0x0d db 0x0a,0x68,0x3a,0x6d,0x6f,0x76,0x20,0x5b db 0x62,0x2b,0x38,0x5d,0x2c,0x61,0x6c,0x0d db 0x0a,0x6c,0x6f,0x64,0x73,0x62,0x0d,0x0a db 0x61,0x6e,0x64,0x20,0x61,0x6c,0x2c,0x31 db 0x35,0x0d,0x0a,0x61,0x64,0x64,0x20,0x61 db 0x6c,0x2c,0x34,0x38,0x0d,0x0a,0x63,0x6d db 0x70,0x20,0x61,0x6c,0x2c,0x35,0x38,0x0d db 0x0a,0x6a,0x62,0x20,0x6e,0x0d,0x0a,0x61 db 0x64,0x64,0x20,0x61,0x6c,0x2c,0x33,0x39 db 0x0d,0x0a,0x6e,0x3a,0x6d,0x6f,0x76,0x20 db 0x5b,0x62,0x2b,0x39,0x5d,0x2c,0x61,0x6c db 0x0d,0x0a,0x6d,0x6f,0x76,0x20,0x61,0x68 db 0x2c,0x36,0x34,0x0d,0x0a,0x6d,0x6f,0x76 db 0x20,0x62,0x78,0x2c,0x31,0x0d,0x0a,0x6d db 0x6f,0x76,0x20,0x63,0x78,0x2c,0x34,0x0d db 0x0a,0x6d,0x6f,0x76,0x20,0x64,0x78,0x2c db 0x62,0x2b,0x36,0x0d,0x0a,0x69,0x6e,0x74 db 0x20,0x33,0x33,0x0d,0x0a,0x70,0x6f,0x70 db 0x20,0x63,0x78,0x0d,0x0a,0x6c,0x6f,0x6f db 0x70,0x20,0x63,0x0d,0x0a,0x6d,0x6f,0x76 db 0x20,0x61,0x68,0x2c,0x36,0x34,0x0d,0x0a db 0x6d,0x6f,0x76,0x20,0x62,0x78,0x2c,0x31 db 0x0d,0x0a,0x6d,0x6f,0x76,0x20,0x63,0x78 db 0x2c,0x35,0x0d,0x0a,0x6d,0x6f,0x76,0x20 db 0x64,0x78,0x2c,0x62,0x2b,0x31,0x31,0x0d db 0x0a,0x69,0x6e,0x74,0x20,0x33,0x33,0x0d db 0x0a,0x6d,0x6f,0x76,0x20,0x61,0x68,0x2c db 0x37,0x36,0x0d,0x0a,0x69,0x6e,0x74,0x20 db 0x33,0x33,0x0d,0x0a,0x62,0x20,0x20,0x20 db 0x64,0x62,0x20,0x31,0x33,0x2c,0x31,0x30 db 0x2c,0x27,0x20,0x64,0x62,0x20,0x30,0x78 db 0x20,0x20,0x2c,0x27,0x2c,0x31,0x33,0x2c db 0x31,0x30,0x2c,0x27,0x65,0x6e,0x64,0x27 end |
| QUOTE (Uraldor @ Nov 13 2003, 02:45 AM) |
| I could do it if I knew how to use C++ language to open a file on my computer. Does anyone know how to do that? I can't see how that will help you solve the problem. You generally don't have the source code of your program available as a file when you're running your program, and opening the source file and blatting it to the screen is cheating ;) So I disagree with you, you can't do it just by opening the exe. You need to be smarter. OJ PS. Yes, the forum is quite new, give it time and it'll build up! There are other programming challenges listed in there aswell if you're interested. |
| CODE |
| QUOTE (Incubator @ Nov 19 2003, 02:15 PM) |
| i'd love to but i dont see any source :P the code tags are empty |
| QUOTE (Kylevision @ Aug 14 2003, 07:45 PM) |
| My challenge to you is to try and to write a program that shows its own source. |
| CODE |
int main() { cout << "its own source."; system("pause"); return 0; } |
| QUOTE |
| depends :P I have about 16gb of both containing source code and the binaries, its quite easy though then, I just read through an ifstream from /usr/portage/distfiles/<packagename>-<versionnumber>/work :P but as usual, big nono for many wwindoze apps.... |
| CODE |
| #include<stdio.h> void main() {char*s="#include<stdio.h>%c void main(){char*s=%c%s%c;printf(s,10,34,s,34,10);}%c"; printf(s,10,34,s,34,10); } |
| QUOTE (abhishek @ Mar 25 2005, 05:04 PM) | ||
i can understand the whole program but i didnt get what this printf(s,10,34,s,34,10) since what i learned was that printf usually was used as something like print("blah"); etc. but all i code make out was that this 34 10 and 10 34 was doing some type converion but i dont know what this 10 34 means :wacko: any help would be greatly appreciated :) |
| CODE |
#include <iostream> using namespace std; int main(){ int a = 10, b = 11; int sum = a + b; cout<<"The sum is "<<a + b<<"\n\n"; cout<<"I am a program made by Shackleb0lt and I show my source:\n\n" //the next would be repetition "#include <iostream>\n" "using namespace std;\n\n" "int main(){\n" " int a = 10, b = 11;\n" " int sum = a + b;\n"; cout<<" cout<<\"The sum is \"<<a + b<<\"\\n\\n\";\n" " cout<<\"I am a program made by Shackleb0lt and I show my source:\\n\\n\"\n" " //the next would be repetition\n" "cin.get();\n" "return 0;\n" "}"; cin.get(); return 0; } |
| CODE |
| #include <iostream> #include <fstream> #include <string> using namespace std; int main() { ifstream in("main.cpp"); // The name of the source file string text; string line; while(getline(in, line)) { text.append(line); text.append("\n"); } cout << text; return 0; } |
| QUOTE (donprogc++ @ Mar 27 2005, 01:15 AM) |
| Nice DeAs91 B) |