Thread: getline()
View Single Post
Old 08-29-2005, 09:36 PM   #2 (permalink)
bradleyc
Registered User
 
Join Date: Aug 2005
Posts: 17
bradleyc is on a distinguished road
Code:
clrscr();
cout << "                      " << endl;
cout << "  -- Current Record --    " << endl;
cout << "  What is the Video Number?: ";
cin.ignore();
cin.getline(temp, '\n');
videoNum = atol(temp);
cout << "  What is the Video Name?: ";
cin.ignore();
cin.getline(videoName, '\n');
But now im not sure how i get the second values, and replace them with the previous values found by the getline...

Code:
cout << "                      " << endl;
cout << "  -- New Record --    " << endl;
cout << "  What is the Video Number?: ";
cin >> videoNum2;


cout << "  What is the Video Name?: ";
cin >> videoName2;



Well i have this array ..

Code:
videoRec videoLib[SIZE]= { {123456, "Alexander",1, {"Joe Bloggs",23215}},
{24687, "Terminator 2", 1, {"Fred Nurks", 23456}},
{54321, "Titanic", 0,{"", 0}}};
For example.. if i enter 123456 and Alexander

-- Current Record --
What is the Video Number?: 123456
What is the Video Name?: Alexander

*Find in array ... where videoNum = 123456 & videoName = Alexander

-- New Record --
What is the Video Number?: 987654
What is the Video Name?: Ben Hur

Code:
videoRec videoLib[SIZE]= { {987654, "Ben Hur",1, {"Joe Bloggs",23215}},
{24687, "Terminator 2", 1, {"Fred Nurks", 23456}},
{54321, "Titanic", 0,{"", 0}}};
*Replace in array ...
bradleyc is offline   Reply With Quote