Thread: I'm not ask for ENTIRE program, only 1 Question !

  1. #1
    Registered User
    Join Date
    Sep 2003
    Posts
    18

    I'm not ask for ENTIRE program, only 1 Question !

    I din ask for ACTUAL answer, ok ?
    I din ask you guy to help me do entire program, i only got ONE question !
    I only wish to know, can i use the functions : strlen, strrev, etc
    Since the question there say "not allowed to use any functions in the <string.h> library."
    Please, only answer me CAN or NOT

    Develop a program that allows the user to enter a string and performing the following operations on it:
    - Count Number of Characters In String
    - Count Number of Words In String
    - Remove Spaces In String
    - Reverse String
    - Reverse Words In String
    - Look For Substring In String
    - Insert Substring Into String

    The following screen suggests a possible user interface:

    Enter String: C is Fun!

    1 ¡V Count Number of Characters In String
    2 - Count Number of Words In String
    3 - Remove Spaces In String
    4 ¡V Reverse String
    5 ¡V Reverse Words In String
    6 ¡V Look For Substring In String
    7 ¡V Insert Substring Into String

    Enter Choice:


    whereby:

    If option 1 is chosen, 7 (including any special characters but excluding spaces) is shown on the screen.
    If option 2 is chosen, 3 is shown on the screen
    If option 3 is chosen, 'CisFun!' is shown on the screen
    If option 4 is chosen, '!nuF si C' is shown on the screen
    If option 5 is chosen, 'C si !nunF' is shown on the screen
    If option 6 is chosen, get user to enter the substring he wants to find and display a message to tell him whether it is in the string
    If option 7 is chosen, get user to enter a substring, and the position he wants to insert into the original string. The new string is then displayed on the screen.
    ----------------------------------------------------------------------------------------------------------

  2. #2
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    strlen, strrev, etc
    No you can't

  3. #3
    Registered User
    Join Date
    Sep 2003
    Posts
    18
    Can't ???
    Then i have to use another method ?
    But i don't think so got another method....

  4. #4
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Hints: loop, '\0'

  5. #5
    Registered User
    Join Date
    Sep 2003
    Posts
    18
    Oh, I See....
    Thanks for helping !

  6. #6
    Registered User
    Join Date
    Sep 2003
    Posts
    18
    Can i use this function in this question :
    Code:
    fflush(stdin);
    ???

  7. #7
    Been here, done that.
    Join Date
    May 2003
    Posts
    1,164
    Originally posted by Th3-SeA
    Can i use this function in this question :
    Code:
    fflush(stdin);
    ???
    No. fflush is not defined for input streams, only output
    Definition: Politics -- Latin, from
    poly meaning many and
    tics meaning blood sucking parasites
    -- Tom Smothers

  8. #8
    Registered User
    Join Date
    Sep 2003
    Posts
    18
    > No. fflush is not defined for input streams, only output

    That mean i cannot use it ?? Right ?

  9. #9
    Registered User
    Join Date
    Oct 2002
    Posts
    385
    Originally posted by Th3-SeA
    > No. fflush is not defined for input streams, only output

    That mean i cannot use it ?? Right ?
    You can use it but like he said, it isn't defined for input streams.
    Wandering aimlessly through C.....

    http://dbrink.phpwebhosting.com

  10. #10
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    And there is no need to flush the input stream anyways.

  11. #11
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Question regarding a this C program
    By cnb in forum C Programming
    Replies: 10
    Last Post: 10-11-2008, 04:43 AM
  2. newb question: probs with this program
    By ajguerrero in forum C Programming
    Replies: 5
    Last Post: 04-19-2006, 08:04 AM
  3. Random Question Assign Program
    By mikeprogram in forum C++ Programming
    Replies: 6
    Last Post: 11-17-2005, 10:04 PM
  4. Question type program for beginners
    By Kirdra in forum C++ Programming
    Replies: 7
    Last Post: 09-15-2002, 05:10 AM
  5. Replies: 8
    Last Post: 03-26-2002, 07:55 AM