Thread: Self-Printing Program - Practice Problem

  1. #1
    Registered User
    Join Date
    Feb 2022
    Location
    Canada, PEI
    Posts
    103

    Self-Printing Program - Practice Problem

    I have a few question about this practice problem.

    First it states that you shouldn't use a IO library(That's how I'm understanding 'no file IO').. No problem because my compiler links against the standard by default so I should be able to throw up some 'proper' function declarations and they should get linked up to the proper code right?

    Second.. What do you mean by it should print its own source code? I know I can use the shell functionality to redirect my source code into my program's stdin channel and print it that way. Is that what the question means by printing its own source code?

  2. #2
    Registered User rstanley's Avatar
    Join Date
    Jun 2014
    Location
    New York, NY
    Posts
    1,111
    You should post the original text of the assignment before we can Commet further.

  3. #3
    Registered User
    Join Date
    Feb 2022
    Location
    Canada, PEI
    Posts
    103
    Well the practice problem is part of this site. Here's the text:
    Write a self-printing program without file IO

    Write a program that, when run, will print out its source code. This source code, in turn, should compile and print out itself. (Fun fact: a program that prints itself is called a quine.)
    Here's the link:

    C/C++ Programming Practice Problems - Cprogramming.com

  4. #4
    Registered User
    Join Date
    Feb 2022
    Location
    Canada, PEI
    Posts
    103
    I looked at the solution that's provided, so I don't need any guidance now.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. File_stream Practice Program
    By Osman Zakir in forum C++ Programming
    Replies: 26
    Last Post: 07-02-2015, 02:44 PM
  2. Printing text with functions in this practice problem
    By twigz in forum C++ Programming
    Replies: 4
    Last Post: 02-28-2014, 07:43 AM
  3. Practice Problem Help!
    By PCBeginner in forum C++ Programming
    Replies: 2
    Last Post: 06-14-2012, 10:24 AM
  4. Replies: 17
    Last Post: 09-21-2009, 09:50 PM
  5. help on this very small practice program
    By incognito in forum C++ Programming
    Replies: 4
    Last Post: 01-01-2002, 10:28 AM

Tags for this Thread