|
video.h
[code]const int SIZE = 10;
struct customerRec {
char customerName[20];
long customerNum;
};
struct videoRec {
long videoNum;
char videoName[30];
int borrowed;
customerRec customer;
};
videoRec videoLib[SIZE]= { {123456, "Alexander",1, {"Joe Bloggs",23215}},
{24687, "Terminator 2", 1, {"Fred Nurks", 23456}},
{54321, "Titanic", 0,{"", 0}}};[/code]
main.cpp
[code]
cout << " What is the Video Number?: ";
cin >> videoNum;
cout << endl <<" What is the Video Name?: ";
cin >> videoName;
videoLib.videoNum = videoNum;
videoLib.videoName = videoName;
displayMenu()
[/code]
How do i add new videoNum and videoName values to the end of that videoRec videoLib array ... in the video.h, isnt not like what im trying to do in the main.cpp is it?
|
|
|
You have to clear your basics
you'll be doing it like this...here i am explicitly
entering in one position of array but u need to use a for loop to enter all the values
main.cpp
--------
#include<iostream>
#include"video.h"
using namespace std;
int main()
{
cout << " What is the Video Number?: ";
cin >> videoLib[1].videoNum;
cout << endl <<" What is the Video Name?: ";
cin >> videoLib[1].videoName;
videoLib[2].videoNum = videoLib[1].videoNum;
displayMenu();
return 0;
}
You need to declare and define diaply menu function before use
"video.h"
const int SIZE = 10;
struct customerRec
{
char customerName[20];
long customerNum;
};
struct videoRec
{
long videoNum;
char videoName[30];
int borrowed;
customerRec customer;
};
videoRec videoLib[SIZE]= { {123456, "Alexander",1, {"Joe Bloggs",23215}},
{24687, "Terminator 2", 1, {"Fred Nurks", 23456}},
{54321, "Titanic", 0,{"", 0}}};
|
|
|
|
|
|
|
|