I need to create a program that will diplay a students schedule once you input the ID number for that student.
There will be 5 arrays in this program
(array 1) Enter 5 Students Names
(array 2) Enter 5 ID#s
(array 3) Enter 3 subjects for each
Enter subject 1 for each
Enter subject 2 for each
Enter subject 3 for each
(array 4) Enter a room for each student & each subject
(array 5) Enter a class time for each subject
So pretty much when all array are filled you are asked to enter a student ID# and it will display a schedule for that student & students name
honestly to tell you the truth thats how the instructions were written if you can help me in any way please do. I believe I had a bad teacher for c++ and I want to switch colleges so I can recieve better training on this. in the end I need to use arrays and as long as my final ouput is the schedule of a student matching the id number of that student with their name is all I need I will read the page where.the link sends me as well
Use of arrays in such assignment is by all means ok, but you need to pay attention to what you put into this arrays, what kind of similar objects are groupped together. My solution would be to create a structure that holds information about one particular student, and then in the main program I would put a group of such objects in an array, but to do this you really need to understand what I linked in previous post.
Also, before you make any hasty decision about your education, follow this easy tutorial on http://www.learncpp.com/ - it is designed for people with 0 programming experience, but after lesson on structs, you'd be able to solve your problem in 5 minutes.
That's a good start. If you can use std::string (this is c++) instead of char arrays (c) that would be cool.
I'll assume you can't though. I'll also assume you have been working with char arrays a while so you know how to use functions like strcpy (copy strings) and strcmp (compare alphabetically), etc.
Some corrections on the structure definition, a few missing ;'s.
1 2 3 4 5 6 7
int ID;// why 5 numbers?
int room;// ditto
To make life easy, I recommend you add an INIT function to the structure.
The student struct definition would then be:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
void INIT(char Name, char Subject1, char Subject2, char Subject3, int Ident, int Room )
strcpy(Name, name);// verify this call!!
strcpy(Subject1, subjects);// I don't use these functions myself anymore.
// and for subjects, 
ID = Ident;
room = Room;
Then in main, you create and initialize an array of students like so:
1 2 3 4 5 6 7 8 9 10 11 12
// declare some students
// INIT them
pupil.INIT("John Doe","Gym","Science","Music", 12345, 321 );
// and for pupil,,
EDIT: I have treated ID and room as single integer numbers, not as arrays. If these really do need to be arrays then make the couple of changes to the last 2 args for INIT and add code to copy each element in INIT.
Also, the code was written on the fly so it probably contains a few errors. My intent is to outline a method.
thank you fun2code i appreciate your help with my program. I do need you to try and elaborate on this a bit more for me actually. I do need arrays for this program but honestly i just need it to run. If i need to i will lose the arrays but i would like to keep them.
Do you mean the arrays int ID; int room; ?
What are they for? In the example case you gave only one number is given for each.
ID = 12345;
room = 321;
What are you planning to do with ID through ID ?
room through room ?
Are you wishing to store one digit per element, or something?
I do need you to try and elaborate on this a bit more for me actually.
I'm just trying to help with ideas. There's enough info above to get the student data entered. The search by student ID number (which of the 5?) can be done after the student data is all initialized, which I showed exactly how to do (one way). Try to get this part working yourself. Research the strcpy function if you need to so you can complete the INIT function.
So i was watchin a few videos and reading some things as well and i believe i have found a way to get this done but again i am stuck please help anyone if you can.Where i am lost is this will print the student names out but i also need it to take the rest of the variables(ID,Subject,Room,Time) and print the schedule per Student ID
here is the code i have so far