Thread: String output

  1. #1
    Registered User
    Join Date
    Aug 2009
    Posts
    10

    String output

    Code:
    int main()
    { string s = "12a34b56c78d";
       int size = 12;
       writeStuff(s,size);
       return 0;
    } // end main
    void writeStuff(string s, int size)
    {     if (size > 0)
         {     cout << s.substr(size-1, 1);
                writeStuff(s, size-3);  
          }  // end if
    }  // end writeStuff
    What is supposed to be the output of this?

  2. #2
    Registered User jeffcobb's Avatar
    Join Date
    Dec 2009
    Location
    Henderson, NV
    Posts
    875
    What the hell? Are you just posting your homework for us to answer? I thought you needed help before so I did but this is the third place you have posted dodgy code asking "Whats the output?"


    What do you *think* the output is?
    C/C++ Environment: GNU CC/Emacs
    Make system: CMake
    Debuggers: Valgrind/GDB

  3. #3
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    2,158
    Download and install GCC, the GNU Compiler Collection - GNU Project - Free Software Foundation (FSF) and Code::Blocks, then build, link, and run the program, and you have your answer.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. IDE for C embedded advanced editing
    By Undici77 in forum Tech Board
    Replies: 32
    Last Post: 01-16-2010, 05:17 PM
  2. Help for my assigment
    By cloverdagreat in forum C Programming
    Replies: 16
    Last Post: 11-21-2009, 12:18 PM
  3. Replies: 4
    Last Post: 04-03-2007, 05:57 AM
  4. Replies: 4
    Last Post: 03-03-2006, 02:11 AM
  5. Another overloading "<<" problem
    By alphaoide in forum C++ Programming
    Replies: 18
    Last Post: 09-30-2003, 10:32 AM