A community for students.
Here's the question you clicked on:
 0 viewing

This Question is Closed

hartnn
 2 years ago
Best ResponseYou've already chosen the best response.1i don't want the exact code, just discuss different logic with which we can do this....

KonradZuse
 2 years ago
Best ResponseYou've already chosen the best response.0Sounds pretty crazy...

KonradZuse
 2 years ago
Best ResponseYou've already chosen the best response.0And the source code has to actually do something itself huh?

hartnn
 2 years ago
Best ResponseYou've already chosen the best response.1no restriction...it can do something else....or it can just output its own source code...

KonradZuse
 2 years ago
Best ResponseYou've already chosen the best response.0Cuz technically you could just write a whole bunch of nonsense as a string ansd then print that :P.

KonradZuse
 2 years ago
Best ResponseYou've already chosen the best response.0Idk why you would ever need to do this, is this some BS school assigment?

hartnn
 2 years ago
Best ResponseYou've already chosen the best response.1not assignment...just curious to know how..

KonradZuse
 2 years ago
Best ResponseYou've already chosen the best response.0Yeah I'm stumped on this one atm....

KonradZuse
 2 years ago
Best ResponseYou've already chosen the best response.0I asked on the code ranch for you, so lets see what they think up....

KonradZuse
 2 years ago
Best ResponseYou've already chosen the best response.0or just creating a billion print statements lol.

hartnn
 2 years ago
Best ResponseYou've already chosen the best response.1lol, a printf inside a printf inside a printf .....and so on..infinite printfs

KonradZuse
 2 years ago
Best ResponseYou've already chosen the best response.0na more like int i = 0; printf("int i = 0);

KonradZuse
 2 years ago
Best ResponseYou've already chosen the best response.0but you could literally do printf("code code code code more code yay code"); If the code doesn't have to run... 1 GIANT print statement...

duckhunt
 2 years ago
Best ResponseYou've already chosen the best response.0Dont know if this will work... but u can try file functions (read and write or standard output)... (assuming u are going to save the source code file first) just ask your code to read that file (source.c) and maybe buffer it in some array .. and then print it :P

duckhunt
 2 years ago
Best ResponseYou've already chosen the best response.0errr... do u want this code to be platform independent?

KonradZuse
 2 years ago
Best ResponseYou've already chosen the best response.0I was also thinking that, but you would have to say what you want to write and read in :p.

rsmith6559
 2 years ago
Best ResponseYou've already chosen the best response.0How about taking argv[0], appending ".c", if the file exists, open it, getc/putc and close it?

across
 2 years ago
Best ResponseYou've already chosen the best response.0This is like asking to build a screwdriver using a screwdriver. :P

KonradZuse
 2 years ago
Best ResponseYou've already chosen the best response.0I found this http://en.wikipedia.org/wiki/Quine_(computing)

hartnn
 2 years ago
Best ResponseYou've already chosen the best response.1quine is interesting, but not in c. rsmith, can u elaborate ?

msmithhnova
 2 years ago
Best ResponseYou've already chosen the best response.0Yeah, quine is an odd area of CS. This code will print everything but the include line. #include <stdio.h> int main() { char *s="int main() { char *s=%c%s%c; printf(s,34,s,34); }"; printf(s,34,s,34); }

rsmith6559
 2 years ago
Best ResponseYou've already chosen the best response.0C is a compiled language. The executing file isn't the source file. Therefore, the program becomes basically, a simple open a file read it in, output it and close the file. A simple guess for the source code file name is the executable file's name with ".c" appended.

KonradZuse
 2 years ago
Best ResponseYou've already chosen the best response.0They have c++ you can change what's needed youself...e

DLS
 2 years ago
Best ResponseYou've already chosen the best response.0Hint: You can save the code onto a textfile and thereafter display it directly via simple input functions :)
Ask your own question
Sign UpFind more explanations on OpenStudy
Your question is ready. Sign up for free to start getting answers.
spraguer
(Moderator)
5
→ View Detailed Profile
is replying to Can someone tell me what button the professor is hitting...
23
 Teamwork 19 Teammate
 Problem Solving 19 Hero
 Engagement 19 Mad Hatter
 You have blocked this person.
 ✔ You're a fan Checking fan status...
Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.