473,324 Members | 2,257 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

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.
Nov 22 '14 #1
5 1369
donbock
2,426 Expert 2GB
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.
Nov 22 '14 #2
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?
Nov 22 '14 #3
weaknessforcats
9,208 Expert Mod 8TB
Write a function to display your data.

Call the function in case 1 and in case 2.
Nov 24 '14 #4
donbock
2,426 Expert 2GB
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.
Nov 24 '14 #5
donbock
2,426 Expert 2GB
What is the switch variable that determines whether the first or second case executes?
Nov 24 '14 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: megha | last post by:
Hi I have string in java now i want to replace that string but at same time I want this string is replaced on same memory location on which first string was. How I can do it. In simple replace...
13
by: bml | last post by:
char s1 = "this string"; char *s2; s2 = (char *)malloc(30); memset(s2, 0, 30); /* this supposes to copy string s1 to s2 */ while((*s2++ = *s1++) != '\0'); /* Why empty content of s2 print...
3
by: marfi95 | last post by:
Hi all. I need to copy a byte array into a string, but starting at a specific location in the byte array. This is where I get hung up. For example if my byte array is (100) big, I might want to...
1
by: Simon | last post by:
Hi, I have a class that does not seem to work. I cannot see the problem, and the "fix" I have found does not help me understand what the problem was I know I don't need a copy constructor but...
12
by: CMirandaman | last post by:
Sounds like a stupid question I know. I can tell that they are used to copy strings. But what is the difference between x = y; versus x = String.Copy(y); Or are they essentially the same?
11
by: akarui.tomodachi | last post by:
I have two structure definitions as below: typedef struct _sourceString { char firstSourceString; char secondSourceString; char thirdSourceString; }sourceString;
6
by: Gary | last post by:
I'm confused about the two ways of string copy below. The first one (two functions) works; the second doesn't. Can anybody explain the reason to me? Thanks a lot. #include <stdio.h> /*this one...
14
by: wahaha | last post by:
Hi, In a small code to implement string copy: while(*a++ = *b++) ; both a and b are char pointers. This code works but at the end, when *a = *b = '\0' finishes, both a and b step one block...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.