Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,153,160 members, 7,818,531 topics. Date: Sunday, 05 May 2024 at 06:04 PM

An INEC Voting Console Program Written In C Language - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / An INEC Voting Console Program Written In C Language (1753 Views)

Need Help With A C Language Problem Can You Be Of Help / Coding Virus To Kill Computer In C++ Language / Does Anyone Still Have This Graphite.exe Program Written By A Nigerian (2) (3) (4)

(1) (2) (Reply) (Go Down)

An INEC Voting Console Program Written In C Language by logicDcoder(m): 1:39pm On Oct 12, 2020
Good afternoon nairalanders. I am Enoch. The idea to write this program came while in the school library(Nnamdi Azikiwe University). I used simple programming concepts to write the program and it was a success. The voting system consist of two sections:
(1) The admin section - Where political parties or candidates(if Political parties are not involved) are registered and the number of voters that will participate in the election is entered.
(2)The Voter Section - Where the voters can now cast there votes.

I broke the program into functions in other to improve it readability and efficiency. I implemented a lot of functions such as those that display menus, registered political parties, statistics, date/time, winner, results etc. and also the ones that sorts the political parties according to number of votes that they have earned(Insertion Sort algorithm) and the one that searches for the political party with the highest vote count(Linear Search Algorithm) and calculates the results in percentages etc.

It took me a lot of time to write especially when I was trying to manage the memory of the program(arrays and stuffs).
The Program took me 9 days to write (2 days to plan, 2 days to be developed and 5 days to debug). I encountered lots of errors(few syntax errors and lots of logical/runtime errors).

1 Share

Re: An INEC Voting Console Program Written In C Language by logicDcoder(m): 1:57pm On Oct 12, 2020
The program consumed 275 lines of code and it's going to consume a lot more because I am planning to improve the program.

UPCOMING IMPROVEMENTS:
1) The statistics and results of the election will be written to a text file instead.(This will gulp about 40 lines of code).
2)The information of each voters will be written to a binary file. Such as name, age, reg_no etc. which can be read into the program.
3)A sort engine that will sort an array of structure holding the voters info according to age(The elderly gets to vote first).
4)The information of each parties written to a binary file.
AND
5) Making all menu selection unbuffered input( Tired of pressing enter key all the time)

With these improvements the program will gulp another maybe 300+ lines of codes.

I would like to challenge other upcoming programmers here to write this simple project using other languages(java, python, c++, etc) !
You will learn a lot while writing the program.

And I also need your advice on how to improve the program and the readability of the codes!

1 Like

Re: An INEC Voting Console Program Written In C Language by logicDcoder(m): 2:05pm On Oct 12, 2020
Now this is the output of the program.
Image 1: The admin section asks the admin to input the administrative passcode.. if you input a wrong passcode it will ask you to insert the correct one(do-while did a very good job here).

Image 2/3: After inserting the correct passcode a menu pops out asking you to register parties.

image 4: Registering the party.

Note: I failed to use unbuffered input for the menu while writing the program so in other to select a menu you need to type the menu number and the press enter(buffered input). in unbuffered input you just need to press the menu number and every other thing will be history!

Re: An INEC Voting Console Program Written In C Language by logicDcoder(m): 2:05pm On Oct 12, 2020
Image 1: After the political and voters registration process the program now asks you to start voting.

image2/3: The screen clears up(Thanks to the line of code: system("clear"wink; ) taking you to the voters section. If the voter is present then can cast his vote but if he's absent it moves to the next voter.

Image 4: When you choose statistics it brings out the current statistics of the election.

Re: An INEC Voting Console Program Written In C Language by logicDcoder(m): 2:17pm On Oct 12, 2020
After the voting process, the program displays the final result of the election!

So nairalanders shebi I tried?

Re: An INEC Voting Console Program Written In C Language by Nobody: 3:01pm On Oct 12, 2020
So people get mind to finish projects like this. gringringrin I never finish projects I set for myself, most are still pending.
Re: An INEC Voting Console Program Written In C Language by logicDcoder(m): 5:53pm On Oct 12, 2020
SegFault:
So people get mind to finish projects like this. gringringrin I never finish projects I set for myself, most are still pending.

Better try and finish them... I wrote this since April and since then I have finished lots of 'em. These projects will really help you sharpen your software dev skills.

1 Like

Re: An INEC Voting Console Program Written In C Language by Nobody: 10:10pm On Oct 12, 2020
logicDcoder:


Better try and finish them... I wrote this since April and since then I have finished lots of 'em. These projects will really help you sharpen your software dev skills.
My problem is that I'm fond of setting projects higher than myself, first I wanted to write a compiler that one I've suspended it for now, then I am currently writing a virtual machine like the jvm to run virtual code for a new language I would like to make in the future though it's not now I started it, it's a long time ago, I tried to write a command line messenger like whatsapp using socket programming after sometime I dumped it, then I thought of making a forum that had better features than stackoverflow I believe I will do this one sometime in the future, I need to learn web development in depth and I need people who are willing to create this revolutionary forum (it's open source)
Re: An INEC Voting Console Program Written In C Language by logicDcoder(m): 11:09pm On Oct 12, 2020
SegFault:

My problem is that I'm fond of setting projects higher than myself, first I wanted to write a compiler that one I've suspended it for now, then I am currently writing a virtual machine like the jvm to run virtual code for a new language I would like to make in the future though it's not now I started it, it's a long time ago, I tried to write a command line messenger like whatsapp using socket programming after sometime I dumped it, then I thought of making a forum that had better features than stackoverflow I believe I will do this one sometime in the future, I need to learn web development in depth and I need people who are willing to create this revolutionary forum (it's open source)
Wow that's nice... bro one thing with this is that the more you create problems n solve the more you learn. Start small, maybe the command-line messenger program
Re: An INEC Voting Console Program Written In C Language by spartan117(m): 10:01am On Oct 13, 2020
Very nice project. Is there any plan to build a GUI for the frontend?
Re: An INEC Voting Console Program Written In C Language by valzey(m): 4:53pm On Oct 13, 2020
This is impressive, but it's time you left C and learn a more applicable language else you'll waste your time reinventing the wheel and still jobless.

You should leave console applications now, especially with C and learn real platforms which are way more complex than a single language such as mobile dev, Web dev, desktop dev, game dev... etc because there are more complex data types and skills to grasp that matter and time is precious.

At your level now, your problem solving skill will be high level and you've learnt all that C can offer you i.e how to implement solutions from scratch.

Continue only if you you want to be an embedded systems developer.

1 Like 1 Share

Re: An INEC Voting Console Program Written In C Language by Bahat: 6:05pm On Oct 13, 2020
Well done job bro. I see your code consist of those functions advised not to be used in coding anymore they are vulnerable. When dealing with C remember to read security blogs for latest news about their vulnerable functions.
Re: An INEC Voting Console Program Written In C Language by EvilSec: 10:35pm On Oct 13, 2020
Bahat:
Well done job bro. I see your code consist of those functions advised not to be used in coding anymore they are vulnerable. When dealing with C remember to read security blogs for latest news about their vulnerable functions.
You're right. It's hard reading code or debugging with screenshots, but it seems I can see a local variable in a function’s stack frame. The return address on the stack can be overwritten... All hail an overflow xD

1 Like

Re: An INEC Voting Console Program Written In C Language by logicDcoder(m): 3:59am On Oct 14, 2020
spartan117:
Very nice project. Is there any plan to build a GUI for the frontend?

Yah but it will be 2022

1 Like

Re: An INEC Voting Console Program Written In C Language by logicDcoder(m): 4:05am On Oct 14, 2020
valzey:
This is impressive, but it's time you left C and learn a more applicable language else you'll waste your time reinventing the wheel and still jobless.

You should leave console applications now, especially with C and learn real platforms which are way more complex than a single language such as mobile dev, Web dev, desktop dev, game dev... etc because there are more complex data types and skills to grasp that matter and time is precious.

At your level now, your problem solving skill will be high level and you've learnt all that C can offer you i.e how to implement solutions from scratch.

Continue only if you you want to be an embedded systems developer.

Ya that's my plan but I learned C as my first language bcus i wanted have deep knowledge of operating systems, pointers, data structures etc.
Learning C as a first language will also make other PL easier to learn. I LEARNT PROGRAMMING THE HARD WAY!
Re: An INEC Voting Console Program Written In C Language by logicDcoder(m): 4:07am On Oct 14, 2020
Bahat:
Well done job bro. I see your code consist of those functions advised not to be used in coding anymore they are vulnerable. When dealing with C remember to read security blogs for latest news about their vulnerable functions.

wow thanks! but the program is just for fun
Re: An INEC Voting Console Program Written In C Language by Nobody: 9:03am On Oct 14, 2020
logicDcoder:


Ya that's my plan but I learned C as my first language bcus i wanted have deep knowledge of operating systems, pointers, data structures etc.
Learning C as a first language will also make other PL easier to learn. I LEARNT PROGRAMMING THE HARD WAY!

Why do we pride on difficult things in this country? What value does it add?

And why do Nigerian software guys always want to reinvent the wheel?
Re: An INEC Voting Console Program Written In C Language by logicDcoder(m): 9:36am On Oct 14, 2020
airsaylongcom:


Why do we pride on difficult things in this country? What value does it add?

And why do Nigerian software guys always want to reinvent the wheel?
It's not about taking pride in difficult things, it's grabbing the hidden treasure there. Professional programmers often say that a programmer that has a knowledge of c/c++ is always a better programmer. So I just don't want to be a programmer, I wanna be a good programmer.
*cheers*
Re: An INEC Voting Console Program Written In C Language by Nobody: 9:42am On Oct 14, 2020
logicDcoder:

It's not about taking pride in difficult things, it's about being one of the best in the thing you're doing. Professional programmers often say that a programmer that has a knowledge of c/c++ is always a better programmer. So I just don't want to be a programmer, I wanna be a good programmer.
*cheers*

Would you say a surgeon knowledgeable in how to perform open surgery is a better surgeon than one who is skilled at keyhole surgery? There's no such thing as a "better programmer". You are skilled in the use of the tools you decide to use (C/C++). Someone else may be skilled using LISP. Different problem areas, different tools
Re: An INEC Voting Console Program Written In C Language by logicDcoder(m): 9:53am On Oct 14, 2020
airsaylongcom:


Would you say a surgeon knowledgeable in how to perform open surgery is a better surgeon than one who is skilled at keyhole surgery? There's no such thing as a "better programmer". You are skilled in the use of the tools you decide to use (C/C++). Someone else may be skilled using LISP. Different problem areas, different tools
No doubt, but I only know the reason I'm learning it right now sir.
airsaylongcom
Re: An INEC Voting Console Program Written In C Language by valzey(m): 11:40am On Oct 14, 2020
logicDcoder:


Ya that's my plan but I learned C as my first language bcus i wanted have deep knowledge of operating systems, pointers, data structures etc.
Learning C as a first language will also make other PL easier to learn. I LEARNT PROGRAMMING THE HARD WAY!
Its good that you understand that but no need to dabble any deeper into memory allocation(garbage collection) and other unfortunate C habitats, those are territory for those entering embedded systems or those unfortunate enough to find themselves supporting old codebases.
Try other platforms, you'll be surprised to find them more complicated than you think. The platform to try depends on the career path you wish to follow. They'll also provide more visible projects and entries to your resume.

C was also my first language and I built complex projects with it: implemented trie data structures and built search algorithms to maximize its features, built http server(very unpleasant, especially string manipulation and error handling), built image deletion recovery software(had to learn about how delete works and about file headers), built student record software just similar to your Voters software but with all your planned features embedded and with C++...etc.
All these forced me to understand what goes on even at the RAM level which other languages shield from their developers. But does that make me a better programmer? NO. But it made me a good C programmer. But more importantly, I learnt them because I was an embedded systems developer and worked with microcontrollers at the time.

which is why I advice you not to go further. It can make you very obsessive about memory management, clearly defined types...etc which could make you less productive when you focus too much on them.

But I'm impressed you stuck out this far and even more impressed you chose C willingly cool
Re: An INEC Voting Console Program Written In C Language by Nobody: 11:46am On Oct 14, 2020
logicDcoder:


I don't want to argue with you... You're right!
Thank you, I love the way you shut him up. C is a versatile language and all those languages he is advising you to use cannot do without c last last, all languages have their own specialities but c is more versatile.
Re: An INEC Voting Console Program Written In C Language by Nobody: 11:49am On Oct 14, 2020
valzey:
This is impressive, but it's time you left C and learn a more applicable language else you'll waste your time reinventing the wheel and still jobless.

You should leave console applications now, especially with C and learn real platforms which are way more complex than a single language such as mobile dev, Web dev, desktop dev, game dev... etc because there are more complex data types and skills to grasp that matter and time is precious.

At your level now, your problem solving skill will be high level and you've learnt all that C can offer you i.e how to implement solutions from scratch.

Continue only if you you want to be an embedded systems developer.
C can be used for anything, I don't know why you guys on nl like discouraging someone, you even said it yourself that you used c for making different things.
Re: An INEC Voting Console Program Written In C Language by valzey(m): 12:25pm On Oct 14, 2020
SegFault:

C can be used for anything, I don't know why you guys on nl like discouraging someone, you even said it yourself that you used c for making different things.
It can, yes. But chances are that you won't use it for much unless you're in special niche. Then why waste that time becoming expert there?

I do not doubt its usefulness but its usefulness to certain persons. Time is precious.
Re: An INEC Voting Console Program Written In C Language by nurain150(m): 12:57pm On Oct 14, 2020
valzey:

It can, yes. But chances are that you won't use it for much unless you're in special niche. Then why waste that time becoming expert there?

I do not doubt its usefulness but its usefulness to certain persons. Time is precious.
This is actually true I wasted time on C for some years.But you can't really do user level application in C except you incorporate C code as a substitute for assembly.Most C are either working on Linux kernel,drivers or game design engine and low level.Op has done well tho.I commend this.
Re: An INEC Voting Console Program Written In C Language by nurain150(m): 12:58pm On Oct 14, 2020
and also there is no robust GUI program for C,Cplusplus is actually better for programs like this.
Re: An INEC Voting Console Program Written In C Language by Nobody: 1:46pm On Oct 14, 2020
valzey:

It can, yes. But chances are that you won't use it for much unless you're in special niche. Then why waste that time becoming expert there?

I do not doubt its usefulness but its usefulness to certain persons. Time is precious.
C is still one of the most popular programming languages, people who write OSes and other hardware drivers still use c, when a new framework for a language wants to be made and the developers want it to be fast they will still go to c, I can go on and on. C will always remain the best (until it is replaced) because the language does not need an os to run its features, check out all other languages they don't have such a feature, now I am not saying that everyone should learn c and I am not saying that it is the best, every programming language has their own qualities, ask computer science students (in sane countries oh not this jackasses hole) and listen to what they will tell you.
Re: An INEC Voting Console Program Written In C Language by Nobody: 1:47pm On Oct 14, 2020
nurain150:
and also there is no robust GUI program for C,Cplusplus is actually better for programs like this.
Qt is there nah. And you can use the winapi for it but man you go see shit.
Re: An INEC Voting Console Program Written In C Language by nurain150(m): 1:50pm On Oct 14, 2020
SegFault:

Qt is there nah. And you can use the winapi for it but man you go see shit.
Yeah nah Qt ,gtk or most library aren't highly document Ed or suitable for C.i once tried learning Qt with C.it was hmm.bc C does not support object op.Cpp is more cool superset that supports this things.
Re: An INEC Voting Console Program Written In C Language by Nobody: 1:52pm On Oct 14, 2020
nurain150:

Yeah nah Qt ,gtk or most library aren't highly document Ed or suitable for C.i once tried learning Qt with C.it was hmm.bc C does not support object op.Cpp is more cool superset that supports this things.
It's true sha. Using the winapi for gui programming is fcking ugly, in fact windows programming is always ugly, only windows socket programming that try self.
Re: An INEC Voting Console Program Written In C Language by nurain150(m): 2:27pm On Oct 14, 2020
SegFault:

It's true sha. Using the winapi for gui programming is fcking ugly, in fact windows programming is always ugly, only windows socket programming that try self.
Am running Linux so no winapi for me.it as to be pure qt or gtk+
Re: An INEC Voting Console Program Written In C Language by Nobody: 6:35pm On Oct 14, 2020
nurain150:

Am running Linux so no winapi for me.it as to be pure qt or gtk+
It's better nah. Winapi is ugly.

(1) (2) (Reply)

Facebook Programming Test / Fortran / Who Knows The Best Bulk SMS Site??

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 75
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.