+ 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

6th Mar 2021, 5:03 AM
KIMBERLY PANGANIBAN
KIMBERLY PANGANIBAN - avatar
24 Respostas
+ 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 |
6th Mar 2021, 10:14 AM
KIMBERLY PANGANIBAN
KIMBERLY PANGANIBAN - avatar
+ 4
KIMBERLY PANGANIBAN You can use Structures to store different types of data into a single type.
6th Mar 2021, 5:35 AM
A͢J
A͢J - avatar
+ 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.
6th Mar 2021, 5:26 AM
A͢J
A͢J - avatar
+ 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.
6th Mar 2021, 12:24 PM
Ipang
+ 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
6th Mar 2021, 9:57 PM
KIMBERLY PANGANIBAN
KIMBERLY PANGANIBAN - avatar
+ 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.
7th Mar 2021, 2:10 AM
Ipang
+ 1
vaibhav what should I do?
7th Mar 2021, 5:51 AM
KIMBERLY PANGANIBAN
KIMBERLY PANGANIBAN - avatar
0
ahm what if i need to merge all of the int, char and string?
6th Mar 2021, 5:12 AM
KIMBERLY PANGANIBAN
KIMBERLY PANGANIBAN - avatar
0
okaay thankyou so much!
6th Mar 2021, 5:30 AM
KIMBERLY PANGANIBAN
KIMBERLY PANGANIBAN - avatar
0
Can you give an example of the desired result and the source of data?
6th Mar 2021, 10:10 AM
Ipang
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
6th Mar 2021, 10:15 AM
KIMBERLY PANGANIBAN
KIMBERLY PANGANIBAN - avatar
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)
7th Mar 2021, 3:39 AM
Kiwwi#
Kiwwi# - avatar
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.
7th Mar 2021, 4:56 AM
vaibhav
vaibhav - avatar
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
7th Mar 2021, 1:29 PM
vaibhav
vaibhav - avatar
0
She asked for different data type for array
7th Mar 2021, 2:59 PM
VANSH74090
VANSH74090 - avatar
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
7th Mar 2021, 4:17 PM
Ev3nt
Ev3nt - avatar
0
Hello
7th Mar 2021, 11:49 PM
Miguel
Miguel - avatar