ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
After endless hours in mirc, and assisted by my engineer father, I have chosen my path.
I have allways wanted to write GOOD game, not some crappy text adventure in qbasic.
And many ppl have told that C++ is best suited for software programming, when C is more common in system programming (unix). I believe I can change some crappy parameters by now, if I want.
I don't actually have any use for that kind of programming (yet).
I loaned C++ programming manual with little over 800(!) sides, that oughta help me to start.
When learning C++ it's much easier when you already know C. Without C, C++ is hard, especially when most manual start OO programming quickly not telling much about the basis.
My most impressive self programmed feat in C is program called Salasana (Password) made by me that starts every time I go to my own home folder.
It asks password 3 times, if given incorrectly all three times, it wont let me in.
Trying to hack it so that it will give command "shutdown -h now" to kernel if given incorrectly.
It also prints "Welcome to Matrix" if given correctly
Your program sounds dangerous to me. In order for you to have the program shutdown the system you will have to either set your program to be setuid root or 'shutdown' to be setuid root. You could have someone shutting down your machine from anywhere.
Anyway don't you have to log into your box only to be asked for the same password or a different password? If it's a different password, how do you store it?
you can use <stdlib.h> and use the system("insertfunctionhere");
for example:
system("shutdown -h now");
would tell the program to shut down the computer. I hope that this helps you, and good luck with c++.
Originally posted by Eits0 And many ppl have told that C++ is best suited for software programming, when C is more common in system programming (unix).
Some people react to discussions of C and C++ as if they are very different, yet actually C++ is a superset of C. Prior to C++ being standardized C++ was implemented using C pre-processor macros. For the experienced C++ programmer there are differences but for a beginner the differences are insignificant except that C++ just has more.
Now, after day 11 on my book (yes, I've loaned it allmost month ago. Just too beautiful weather, too much friends and too much beer to hang inside.) I've finally finished my VERY FIRST GAME!!!!
Just simple text-adventure that prints something like "You see a well." then gives you choices like "a: Drink from it b: jump there c: blast it to oblivion d: run in panic!". Then you press some button and see concequenses!
I've already played it 10++ times over and over! It's sooooo good!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.