A clarification of my print function query

This is a discussion on A clarification of my print function query within the C++ Programming forums, part of the General Programming Boards category; /* I want to change this program... */ Code: main() { one(); two(); three(); } one() { printf("\nmessage 1"); } ...

  1. #1
    Registered User
    Join Date
    Feb 2003
    Posts
    5

    A clarification of my print function query

    /*
    I want to change this program...
    */

    Code:
    main()
    {
       one();
    
       two();
    
       three();
    }
    
    one()
    {
       printf("\nmessage 1");
    }
    
    two()
    {
       printf("\nmessage 2");
    }
    
    three()
    {
       printf("\nmessage 3");
    }
    /*
    ...to this program.
    */

    Code:
    main()
    {
       one();
    
       two();
    
       three();
    }
    
    one()
    {
       /*How do I call printall to print "\nmessage 1" only?*/
    }
    
    two()
    {
       /*ditto "\nmessage 1"*/
    }
    
    three()
    {
       /*ditto "\nmessage 1"*/
    } 
    
    printall()
    {
       printf("\nmessage 1");
       printf("\nmessage 2");
       printf("\nmessage 3");
    }
    /*I'm unsure about what code to place in one(), two() and three()... Any answers?

    Thanks all,

    clinamen

  2. #2
    Registered User
    Join Date
    Feb 2003
    Posts
    5

    Thanks

    Many thanks, looks like just what I'm looking for!

    Paul

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 02:53 AM
  2. <Gulp>
    By kryptkat in forum Windows Programming
    Replies: 7
    Last Post: 01-14-2006, 01:03 PM
  3. Scope And Parameter Passing
    By djwicks in forum C Programming
    Replies: 6
    Last Post: 03-28-2005, 08:26 PM
  4. Creating a student grade book-how?
    By Hopelessly confused in forum C Programming
    Replies: 5
    Last Post: 10-03-2002, 09:43 PM
  5. Contest Results - May 27, 2002
    By ygfperson in forum A Brief History of Cprogramming.com
    Replies: 18
    Last Post: 06-18-2002, 02:27 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21