codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  Struct Help...  bradleyc at 08:45 on Monday, August 29, 2005
 

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?


  Re: Struct Help...  vector at 17:30 on Monday, August 29, 2005
 

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}}};









CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  Why Use Method?
•  Re: Help with filesystem object & displaying in a table
•  Re: Genetic Algorithm Help
•  Re: How to make an investment calculator
•  Re: line breaks in GUI
•  Re: Graph in Gui...
•  Graph in Gui...
•  Re: Counting zero values in a string
•  Re: Help!


Recent Articles
Multiple submit buttons with form validation
Understanding Hibernate ORM for Java/J2EE
HTTP screen-scraping and caching
a javascript calculator
A simple way to JTable
Java Native Interface (JNI)
Parsing Dynamic Layouts
MagicGrid
Caching With ASP.Net
Creating CSS Buttons


Site Survey
Help us serve you better. Take a five minute survey. Click here!

© Copyright codetoad.com 2001-2005