By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,234 Members | 1,896 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,234 IT Pros & Developers. It's quick & easy.

getline()

P: 12
Expand|Select|Wrap|Line Numbers
  1. clrscr();
  2. cout << "                      " << endl;
  3. cout << "  -- Current Record --    " << endl;
  4. cout << "  What is the Video Number?: ";
  5. cin.ignore();
  6. cin.getline(temp, '\n');
  7. videoNum = atol(temp);
  8. cout << "  What is the Video Name?: ";
  9. cin.ignore();
  10. cin.getline(videoName, '\n');
  11.  
But now im not sure how i get the second values, and replace them with the previous values found by the getline...

Expand|Select|Wrap|Line Numbers
  1. cout << "                      " << endl;
  2. cout << "  -- New Record --    " << endl;
  3. cout << "  What is the Video Number?: ";
  4. cin >> videoNum2;
  5.  
  6.  
  7. cout << "  What is the Video Name?: ";
  8. cin >> videoName2;
  9.  
  10.  
  11.  



Well i have this array ..

Expand|Select|Wrap|Line Numbers
  1. videoRec videoLib[SIZE]= { {123456, "Alexander",1, {"Joe Bloggs",23215}},
  2. {24687, "Terminator 2", 1, {"Fred Nurks", 23456}},
  3. {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

Expand|Select|Wrap|Line Numbers
  1. videoRec videoLib[SIZE]= { {987654, "Ben Hur",1, {"Joe Bloggs",23215}},
  2. {24687, "Terminator 2", 1, {"Fred Nurks", 23456}},
  3. {54321, "Titanic", 0,{"", 0}}};
*Replace in array ...
Aug 30 '05 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.