I have a quick question on an assignment I have to do
I need to be able to write a function that takes an input stream and a video(from a class Video), out of 4 total video variables, as a parameter. The function that i called "inputVideo" is supposed to read information from the input stream into the video parameter. We are not supposed to do any prompting in the function.
So far I only know how to take an input stream as a parameter, but I'm getting really confused on how to take a video as one and then read the information from one to the other, without prompting in the function.
Also I'm confused on how to call the function in main.
Here is some code I have written out that uses the class and such that is directly in main:
Expand|Select|Wrap|Line Numbers
- cout << "Please enter the information for your video in the following format: "
- << endl;
- << "The title, the number of videos owned, number of videos available:"
- << endl;
- //read info. from video1 and put info. into it
- while (isspace(cin.peek()))
- cin.ignore();
- getline(cin, temp);
- video1.setTitle(temp);
- cin >> tempint;
- video1.setNumOwned(tempint);
- cin >> tempint2;
- video1.setNumAvailable(tempint2);
Any help would be greatly appreciated.
Thanks,
mrspiff