I did a code that allow to register students 2-show users registered 3-order users registered by code and 4-search for an user by code. My problem is in the step 4, i did the code, and it prints, but it don't show what it should show. What i did wrong? the other parts of the code work well. The code is in spanish, but the mistake is in function #4 "buscarRegistro.
PLEASE ALWAYS USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post. http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.
Line 10-11: Globals are a bad idea.
Line 13: typedef isn't required. Give the struct a tag.
Line 65: What is this line supposed to do? It does nothing.
Lines 70-73: Why are you searching unused entries? You should be searching nr entries.
Lines 77-84: Why are you printing unused entries? Shouldn't you be printing just the entry where code was found?
Lines 86-87: If cod wasn't found, you're printing "codigo no encontrado" 100 times? Do you really mean to do this?
@jonnin ban='v' is the value for true, no? I'm not sure, that's why I was asking for help.
@AbsractionAnnon, I will take your advice about the code tags, thanks. Also thanks for your feedback, I see I have a lot of mistakes.
In lines 86-87 if cod wasn't found it's supposed to primt just one time "codigo no encontrado". In the for, instead of i<100 is for(int i=0;i<cod;i++)?
I tried your code in dev-c, it's better now, but it has still a failure, it prints first "code not found" like two times, but then in prints code found and the data of that student.
let me say it this way:
if you run the program in the debugger and go through it, does that flag's values match what they should be in all cases in all functions? If ban has the wrong value at any point in the program, your functions will give incorrect answers.