Hello,
i dont know where is the problem.
i should input some data in the linked-list.
when i put 2 person,the result just show the last person.
can someone help me to solve this prob ?
this is my code :
Code:REMOVED
Hello,
i dont know where is the problem.
i should input some data in the linked-list.
when i put 2 person,the result just show the last person.
can someone help me to solve this prob ?
this is my code :
Code:REMOVED
Last edited by vearns; 04-08-2008 at 12:41 PM.
Hm?
Code:system("CLS");
I might be wrong.
Quoted more than 1000 times (I hope).Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
oo yeah..
my fault.
hahahahaha.
thanks.
can someone show me how to list out person who have salary less than 100 ?
Can't you just go through the list (like your code currently does) and then use an if statement to check the salary and only output if the salary is less than 100?
Give it a go, and if you can't solve it yourself, post your attempt.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
ok,
here is my code
the compiler dont show any error.Code:REMOVED
but when i test the program,it crash.
maybe stuck in the loop or something ?
Last edited by vearns; 04-08-2008 at 12:40 PM.
If you want to list ONLY those who are under 100 in salary, perhaps you should put the if-statement inside your loop.
If you want to first print ALL entries, then only the ones under 100, then you need two loops.
Your current code crashes, because temp3 is NULL when the loop is done.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
ok,Code:REMOVED
i put inside the loop and it still crash.
Last edited by vearns; 04-08-2008 at 12:40 PM.
Your if-statement is after the "next" step, which means on the last iteration, it's going to access NULL->salary, which is an invalid memory location.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
ok mats,
i found the solution,
i put it like this
however,it seems not so good if we have more than 1 person that have less than 100 salary and not a great solution since the person who have salary less than 100 always appear before NAME,SALARY...etc.Code:REMOVED
maybe you can give me some other ideas ?
Last edited by vearns; 04-08-2008 at 12:40 PM.
What part of that code is outputting the person information?
When you find that code, put it inside the if block since you only want the output to happen if the if statement is true.
OK,i did a lot of changes in my code.
thanks to mats who give the idea to me.
here is my code
now i faced with 2 more problems.Code:REMOVED
1.for Person with salary less than 100 and not in SALES DEPMNT,the system should display only person who do not work under SALES DEPMNT.but i dont know why the system show the person with SALES department also.where is the problem ?
2.how to make the system can calculate how much average salary to person who join after 1 Jan 2008 ? i declared date as string.i dont think system know it is a date.need some idea from u.
Last edited by vearns; 04-08-2008 at 03:07 PM.
The problem isand to fix this you'll need to beCode:REMOVEDCode:REMOVED
My homepage
Advice: Take only as directed - If symptoms persist, please see your debugger
Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"
Your code still doesn't look quite right. It is moving to the next value only in the if block.
LOL. REMOVED ?
hahahaha
i removed old codes.
and i put my new codes.