![]() |
| ||
| C++ Address Book Hi, I have to write an address book using structs for a class. I have 90% of the code done, but I am having trouble ordering it. It is supposed to read in 10 entries from a file and then sort them by last name. All the information also has to be swapped. I am using Microsoft VC++ 6. I would appreciate any input on what might be wrong with this program. Thanks for the help. :) #include <iostream> |
| ||
| Re: C++ Address Book Just incase anyone is having the same problem, I got it after much work. I guess my inputs on the date were wrong, causing traumatic memory problems :) If anyone is interested in the code, here it is #include <iostream> |
| ||
| Re: C++ Address Book just wanted to let you know that you've re-discovered the 'bubble sort' algorithm. The code looks fine except that you should use 'x += 1' instead of 'x = x + 1' -- it's faster. you may not see much of a difference in a loop of that many iterations or with numbers, but it'll really help with strings and loops with more iterations. Besides, it's faster to type! Keep up the good work |
| ||
| Re: C++ Address Book it is faster to type but there's no difference in the code generated, test it and see for yourself. |
| ||
| Re: C++ Address Book According to this book I have, 'C++ for Game Programmers' published by Charles River Media, it says that it's a lot faster when dealing with CString operations, I will go back to it and make sure, but I'm pretty sure now. I haven't tested it, but I was taking the book's word. But I appreciate your comment; that makes me investigate!! |
| ||
| Re: C++ Address Book ok, if you're talking about something high level like that it may be true, but for say some simple integer x it makes no difference in the generated asm. :) |
| All times are GMT -4. The time now is 4:10 pm. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC