Go Back   Forums > Community Chatterbox > Tech Corner > Programming
Memberlist Forum Rules Today's Posts
Search Forums:
Click here to use Advanced Search

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 03-12-2009, 03:08 AM   #2
El Quia
Abandonia Homie
 
El Quia's Avatar


 
Join Date: Oct 2005
Location: Capital Federal, Argentina
Posts: 582
Default

I haven't really read all the code, and I am feeling somewhat sleepy and I am about to hit the sack, so maybe I am talking nonsense, but I think I see which is the problem. But, I can also be messing things up because of my ignorance about c++

I think the problem is that you are putting the user input into an int. And then evaluating that input (an int) and pretending that the program realized when it is really a number and when it is another thing. Each character the user is inputing goes to the int as a group of chars, so I think that messes up everything. In these cases I think it is better to take the user input and put it into a string and then parse the string first to check if it is a numeric value or if it is anything else. And only if it is a numeric value, I would check if it falls between the values required. I don't know how many parsing functions the string object has in C++, so maybe it is something of a mess to do that. But assuming that the user will input a number is always a dangerous presumption. ALWAYS try the user input as typed by a moronic child hitting the keyboard in anger. Most of the time, you will be right

I got some curiosity at you checking twice in each loop at the condition (target<1 || target>records). Maybe it is a necessity here, maybe there is another way to express that without redundancy. But I can't decide now, as I am really too sleepy.

Well, I hope I could help you, this time . And if I wasn't of help, then blame my sleep deprivation! (which is odd, because I want' really sleep deprived, today...)
El Quia is offline                         Send a private message to El Quia
Reply With Quote
 


Similar Threads
Thread Thread Starter Forum Replies Last Post
Killer Loop [SOLD] Paco Rejected requests 2 04-08-2011 04:47 PM
X-COM 1 (UFO) Saving game locks up - Dosbox Thraka Troubleshooting 3 19-06-2008 12:10 AM
Infinite Dungeons For Nwn Lucullus Gaming Zone 13 20-06-2006 12:23 PM
Gauntlet 2 System Loop insidious Troubleshooting 7 18-05-2006 08:49 AM
Eternam - computer locks up wendymaree Troubleshooting 6 02-08-2004 08:43 AM


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump
 


The current time is 07:27 PM (GMT)

 
Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.