Hi all,

I'm quite new to C++!! I'm also having a bit of a problem with a for loop

Its that I have an if statement inside a for loop

if (cuno == customers[i].custno)

when I try to add an else within the for, it repeats the message 3 times as this is how many records are in my array "customers".
I have tried using a break, this solves the problem but does not accept anymore inputs as correct for the if statement

Any help would be appreciated,


9 Years
Discussion Span
Last Post by Kev06N

Sorry guys its not an array its a struct! that I'm trying to edit!


And where are data declarations?
Please, Read This Before Posting: http://www.daniweb.com/forums/thread78223.html

I've had a read of that sorry I was just too keen to get any tips on this. :-)

Thanks anyway but I've managed to solve this one now, the thought is appreciated though,

I just could'nt get my head around the code at first, turns out all I needed to do was make a BOOL found = 0, set it to one if the record to be edited was found, then IF (!found). that stopped it displaying 3 times .

Thanks again though,


This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.