How do you use a string copy?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Craigalee
    New Member
    • Nov 2014
    • 2

    How do you use a string copy?

    I am creating a menu driven using switch case, I entered information in the first case, which I then want to display when I exit that case. Now I want to display the information in my second case.
  • donbock
    Recognized Expert Top Contributor
    • Mar 2008
    • 2427

    #2
    Please provide a concrete example of what you want to do. Typically you need a loop that repeatedly executes the switch statement in order for more than one case to execute. The order of cases in your source code does not necessarily correspond with the order that the cases execute when the program runs.

    Comment

    • Craigalee
      New Member
      • Nov 2014
      • 2

      #3
      This is for the first case.
      For each application,the system should prompt the user for the:
      Student’s Name.

      This is for the second case.
      The program should simply display the following for each student:
      Student Name

      So, upon entering the information using an array, how do I get to display what has been entered in the first case into the second after exiting the first case?
      Last edited by Craigalee; Nov 22 '14, 04:33 PM. Reason: Clarifying what I mean.

      Comment

      • weaknessforcats
        Recognized Expert Expert
        • Mar 2007
        • 9214

        #4
        Write a function to display your data.

        Call the function in case 1 and in case 2.

        Comment

        • donbock
          Recognized Expert Top Contributor
          • Mar 2008
          • 2427

          #5
          The array where you store the entered information needs to be accessible to both cases. Furthermore, you need to insure that it is either impossible to execute the second case before the first; or if that happens, to prevent the second case from accessing the uninitilized array.

          Comment

          • donbock
            Recognized Expert Top Contributor
            • Mar 2008
            • 2427

            #6
            What is the switch variable that determines whether the first or second case executes?

            Comment

            Working...