+ 7
Can I merged arrays that have different data type?
like int, string and char? because we need to search, delete and update a value in the array which is based on user input
17 odpowiedzi
+ 6
Ipang
Create program that will accept user inputs to the following array, input will be inserted one at a time per array:
string Name[n];
int age[n];
char gender;
string course;
then it will be displayed as
| Name | Age | Gender | Course |
| Kimb | 18 | F | BSIT |
+ 4
KIMBERLY PANGANIBAN
You can use Structures to store different types of data into a single type.
+ 3
Dino Wun (Use the search bar plz!)
She asked for different data type of array.
KIMBERLY PANGANIBAN
Array can be of same data type only. So you can't merge two different data type of array.
+ 3
KIMBERLY PANGANIBAN
I don't understand, there is no menu for merging arrays. I see Insert, Search, Delete, Update record. Where is the need to merge the array I just don't get it.
+ 1
Ipang
Im sorry coz I dont really get it how can I search those records. Im still learning
Martin Taylor
It is not mandated to do it in this I just asked hehe, and it is just an activity given to us but I can't think of the solution
+ 1
KIMBERLY PANGANIBAN
About searching records, we can simply use a loop to iterate through an array, we just break out of the loop once we find what we want.
Search would be better and generally be faster if we also sort the array by specific field e.g. student role number or name, depending on what we search regularly.
+ 1
vaibhav what should I do?
0
ahm what if i need to merge all of the int, char and string?
0
okaay thankyou so much!
0
Can you give an example of the desired result and the source of data?
0
Once the arrays are all set, the user will be prompted with the following options:
[1] Insert another record
[2] Search a record
[3] Delete a record
[4] Update a record
[5] exit the program
0
No. As work around, you can:
* build an array (or other data structure) with a struct that holds 2 values of different type
* or build a struct that holds two arrays
depending on the approach
(also you can use objects instead)
0
KIMBERLY PANGANIBAN I think you're asking it for your assignment and the menu or records you're talking about can be done with file handling easily , as I've already created a college management ( I think your assignment is also similar with it ) in C and C++ both.
0
KIMBERLY PANGANIBAN you should learn those concepts
If I'm right about your assignment then it has involved following concepts
Structure
File handling
Switches
Loops
Functions etc
What can you do ?
- you can learn it so that you can make it
- in case of you've less time then you can follow any video tutorial
- ask other for code ( but it's a learning plateform so you should ask only your closed ones )
- well I've the code already
0
She asked for different data type for array
0
Yeap, just use & and *. Don't forget about different data size like a int(4 bytes) and double(8 bytes).
https://code.sololearn.com/cx7V0rq3yg61/?ref=app
0
Hello