•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 423,353 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 5,153 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser: Programming Forums
Views: 793 | Replies: 31 | Solved
![]() |
•
•
Join Date: Jul 2005
Posts: 1,138
Reputation:
Rep Power: 9
Solved Threads: 149
>The problem actually is i dont get the corect no of spolit ballots...i get it as 4325678>
between line 10 where you declare the variable called invalid and line 26 where you increment the variable called invalid by one you never initialize/assign the variable called invalid to any given value, so it's junk. In you increment junk by one you still get junk. When you display the variable called invalid you will display junk. To correct this problem you need need initialize/assign the variable called invalid to some valid value before you try to increment/output it or use it in some other way (the same goes for all other variables you will ever use as well so learn the lesson well or you are doomed to repeat it indefinitely). In this case you probably want to initialize/assign the value called invalid to zero some place between line 10 and line 26, say maybe make line 11 look like this:
invalid = 0;
between line 10 where you declare the variable called invalid and line 26 where you increment the variable called invalid by one you never initialize/assign the variable called invalid to any given value, so it's junk. In you increment junk by one you still get junk. When you display the variable called invalid you will display junk. To correct this problem you need need initialize/assign the variable called invalid to some valid value before you try to increment/output it or use it in some other way (the same goes for all other variables you will ever use as well so learn the lesson well or you are doomed to repeat it indefinitely). In this case you probably want to initialize/assign the value called invalid to zero some place between line 10 and line 26, say maybe make line 11 look like this:
invalid = 0;
Last edited by Lerner : Jul 8th, 2008 at 10:06 am.
![]() |
•
•
•
•
•
•
•
•
DaniWeb C++ Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- Crunchie, can you help me? (Viruses, Spyware and other Nasties)
Other Threads in the C++ Forum
- Previous Thread: Program Direction Advice Please
- Next Thread: What would you reccomend me to do?



Linear Mode