Strings programming help

Discussion in 'C++' started by tzfrantic, Apr 16, 2012.

  1. tzfrantic

    tzfrantic New Member

    Joined:
    Apr 16, 2012
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    i am doing my code in borland 5.02

    i am trying to write a program that allows the user enter in two strings when prompted

    the program performs certain manipulation with the second string and then adds the result to the first string.

    the program should give me the user the choice of searching a string for a particular character,
    reversing the string ,changing the case of the string and reversing and changing the case of the string the output of the above string manipulation must be preceded by the first string.


    the program should be written using modular programing techniques such as functions using parameters where possible to reduce the use of global variables.

    the user should be allowed to repeat any of the string manipulations more than once in the same run of the program and be allowed to change the input strings to be manipulated during a run of the program.

    i have written out a code but it is completely wrong and i am trying to get better at c++ any help with this program.
     
  2. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    How far have you got and where are you stuck? Do you understand the project requirements?
     
  3. tzfrantic

    tzfrantic New Member

    Joined:
    Apr 16, 2012
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    i got this far the requirements are on the first post and i am stuck on were to go from here
    Code:
    #include <iostream.h> #include <string.h>  int main(void) {     string s;     getline(cin, s);     cout << s << endl;     return 0; }
     
  4. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    Good start. Double that and you've got the first part.

    After that you need to display a menu of choices: reverse string, change case and so on, get the user's choice, then a switch/case to perform the operation. The menu display and switch will need to be in a loop so that the actions can be repeated as requested, and one of the menu choices will need to be to exit the program.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice