yes i agree since in the question they dint mention so we can solve it the other way also .
On Sun, Aug 28, 2011 at 7:31 PM, saurabh singh <saurab...@gmail.com> wrote: > Well if you go on using system calls functions etc the job can easily be > done in many ways but the real idea behind the quine problem is the good old > spirit of a challenge (not merely for an interview) So the best way remains > the store everything way... > > On Sun, Aug 28, 2011 at 3:11 PM, aditya kumar < > aditya.kumar130...@gmail.com> wrote: > >> one more method : use system funtion . >> eg system("cat filename") //system funtion executes the command >> >> >> On Sun, Aug 28, 2011 at 1:51 PM, UTKARSH SRIVASTAV < >> usrivastav...@gmail.com> wrote: >> >>> good logic >>> >>> >>> On Sun, Aug 28, 2011 at 12:14 AM, Piyush Grover < >>> piyush4u.iit...@gmail.com> wrote: >>> >>>> yeah you can do that by opening the file and printing it but as far as I >>>> know, interviewer adds the constraint of not using the file method. >>>> >>>> >>>> On Sun, Aug 28, 2011 at 12:35 PM, rahul sharma <rahul23111...@gmail.com >>>> > wrote: >>>> >>>>> this logic is ok...but we have pre defined everything in char f...if i >>>>> add one or two more statements then it will require corresponding >>>>> change in char *f...can i open the same file with f open n prin t it >>>>> out????? >>>>> >>>>> On Aug 28, 11:31 am, Piyush Grover <piyush4u.iit...@gmail.com> wrote: >>>>> > char*f="char*f=%c%s%c;main(){printf(f,34,f,34,10);}%c"; >>>>> > >>>>> > f is a global pointer to the char array which contains the string >>>>> > "char*f=%c%s%c;main(){printf(f,34,f,34,10);}%c" >>>>> > >>>>> > Now in main function you are printing this string with arguments >>>>> 34,f,34,10. >>>>> > ASCII value of " is 34. >>>>> > ->So in f, the first %c is replaced by ". >>>>> > ->The next %s is replaced by string f. >>>>> > ->the second %c is replaced by " and >>>>> > ->last %c is replaced by backspace. The last %c is actually I feel >>>>> not >>>>> > required. So the code can be: >>>>> > >>>>> > >>>>> char*f="char*f=%c%s%c;main(){printf(f,34,f,34);}";main(){printf(f,34,f,34); >>>>> } >>>>> > >>>>> > I hope it helps. Try to do it manually on paper. You would be able to >>>>> > understand it. >>>>> > >>>>> > -Piyush >>>>> > >>>>> > On Sun, Aug 28, 2011 at 11:46 AM, rahul sharma < >>>>> rahul23111...@gmail.com>wrote: >>>>> > >>>>> > >>>>> > >>>>> > >>>>> > >>>>> > >>>>> > >>>>> > > plz expalin char*f=" " >>>>> > >>>>> > > On Aug 28, 11:12 am, Piyush Grover <piyush4u.iit...@gmail.com> >>>>> wrote: >>>>> > > > it's a quine problem. >>>>> > >>>>> > > > char*f="char*f=%c%s%c; >>>>> > > > main(){ >>>>> > > > printf(f,34,f,34,10);}%c"; >>>>> > >>>>> > > > main() >>>>> > > > { >>>>> > > > printf(f,34,f,34,10); >>>>> > >>>>> > > > } >>>>> > >>>>> > > > I have used whitespaces to make it understand. >>>>> > >>>>> > > > On Sun, Aug 28, 2011 at 11:39 AM, rahul sharma < >>>>> rahul23111...@gmail.com >>>>> > > >wrote: >>>>> > >>>>> > > > > program whose output is the program itself??????????????? >>>>> > >>>>> > > > > -- >>>>> > > > > You received this message because you are subscribed to the >>>>> Google >>>>> > > Groups >>>>> > > > > "Algorithm Geeks" group. >>>>> > > > > To post to this group, send email to >>>>> algogeeks@googlegroups.com. >>>>> > > > > To unsubscribe from this group, send email to >>>>> > > > > algogeeks+unsubscr...@googlegroups.com. >>>>> > > > > For more options, visit this group at >>>>> > > > >http://groups.google.com/group/algogeeks?hl=en. >>>>> > >>>>> > > -- >>>>> > > You received this message because you are subscribed to the Google >>>>> Groups >>>>> > > "Algorithm Geeks" group. >>>>> > > To post to this group, send email to algogeeks@googlegroups.com. >>>>> > > To unsubscribe from this group, send email to >>>>> > > algogeeks+unsubscr...@googlegroups.com. >>>>> > > For more options, visit this group at >>>>> > >http://groups.google.com/group/algogeeks?hl=en. >>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "Algorithm Geeks" group. >>>>> To post to this group, send email to algogeeks@googlegroups.com. >>>>> To unsubscribe from this group, send email to >>>>> algogeeks+unsubscr...@googlegroups.com. >>>>> For more options, visit this group at >>>>> http://groups.google.com/group/algogeeks?hl=en. >>>>> >>>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Algorithm Geeks" group. >>>> To post to this group, send email to algogeeks@googlegroups.com. >>>> To unsubscribe from this group, send email to >>>> algogeeks+unsubscr...@googlegroups.com. >>>> For more options, visit this group at >>>> http://groups.google.com/group/algogeeks?hl=en. >>>> >>> >>> >>> >>> -- >>> *UTKARSH SRIVASTAV >>> CSE-3 >>> B-Tech 3rd Year >>> @MNNIT ALLAHABAD* >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Algorithm Geeks" group. >>> To post to this group, send email to algogeeks@googlegroups.com. >>> To unsubscribe from this group, send email to >>> algogeeks+unsubscr...@googlegroups.com. >>> For more options, visit this group at >>> http://groups.google.com/group/algogeeks?hl=en. >>> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to algogeeks@googlegroups.com. >> To unsubscribe from this group, send email to >> algogeeks+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> > > > > -- > Saurabh Singh > B.Tech (Computer Science) > > MNNIT ALLAHABAD > > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.