473,394 Members | 1,866 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,394 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 1372
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.