c++ questions Created 15 years ago2008-10-05 15:42:08 UTC by Striker Striker

Created 15 years ago2008-10-05 15:42:08 UTC by Striker Striker

Posted 15 years ago2008-10-05 15:42:46 UTC Post #256701
Hi . I need a little help with c++ , if somebody knows this language ...

First of all , I hadn't coded for a long time ( 5 months) and I forgot some things . Anyway I'm a beginner , I don't know that much .... just got to the "while" instruction in my book.(I bought a c++ book)

My questions reffer to the system("thecommand") command .

I need to know the following info :

1. system("CLS"); //clears console screen ?
2. system("pause");// I know what this does ...
3. I remember there is a time pause command , using system("time") or something but I don't remember well . Can somebody tell me how this works ?
4. I remember one can use this command to change the backround\fontcolor as well . Please explain me how .

If you know more system useful commands , please post them here , they might be useful .

Thnx in advance .
Striker StrikerI forgot to check the oil pressure
Posted 15 years ago2008-10-05 16:00:13 UTC Post #256703
http://www.cplusplus.com/reference/clibrary/cstdlib/system.html
The string values of the system() function are just console commands.

I think question 2 is the answer to question 3:
http://www.gidnetwork.com/b-61.html

You can change terminal colours with the s/printf() command.
http://www.cplusplus.com/reference/clibrary/cstdio/printf.html
http://linuxgazette.net/issue65/padala.html

You might be better off learning a more simplified language like Visual Basic or PHP before diving straight into C++.
Penguinboy PenguinboyHaha, I died again!
Posted 15 years ago2008-10-05 16:17:26 UTC Post #256704
Wait a second , those links are things I don't understand yet . I've just asked about the system things ...

[EDIT] I found out about the time pause . you have to #include <windows.h>
and the command is : Sleep (#miliseconds)
And I found out about something else , the program name : system("title")

Now somebody tell me about the colour system.
Striker StrikerI forgot to check the oil pressure
Posted 15 years ago2008-10-05 16:24:24 UTC Post #256706
What's not to understand about it? It looked pretty straight forward to me, what exactly are you looking for? And do you know any programming at all?
Posted 15 years ago2008-10-05 16:31:27 UTC Post #256707
And do you know any programming at all?
Of course I know , else I wouldn't have posted here . But I told you know only basic things .

[EDIT] I'm going to bed , it's late now and tomorrow I have 7 hours of fucking school . good night ...I'll be back after school with some more questions
Striker StrikerI forgot to check the oil pressure
Posted 15 years ago2008-10-05 19:04:12 UTC Post #256710
and tomorrow I have 7 hours of fucking school
Well you're lucky because I have 13 hours of work + university. Don't cry lol
Posted 15 years ago2008-10-05 23:16:49 UTC Post #256714
Read your book. I know it's probably boring as hell, but it's probably better if you know as much as possible before starting any projects.

I have a C++ book, I have learned about classes and streams and stuff, but now, when I only have 200 pages left it's boring as hell, just as it were in the beginning.

Good luck BTW.
Oskar Potatis Oskar Potatis🦔
Posted 15 years ago2008-10-05 23:36:58 UTC Post #256715
Completely wrong, potatis. I have never read a programming book in my life, and I know several programming languages. Practical experience is a lot better than reading some stupid old book. I knew nothing about PHP when I started TWHL3, nothing about C# when I started Twister 5, nothing about Visual Basic when I started my first VB program, nothing about C++ when I started that, either. To be fair, I was taught Java, Assembly, C (and C++, but this was after my first C++ project) and Scheme at uni, but not from a book.
Penguinboy PenguinboyHaha, I died again!
Posted 15 years ago2008-10-06 03:13:44 UTC Post #256720
True, diving into a project and really needing to learn something is much better then getting the knowledge merely from books, most of the times you will forget it anyway, and you remember the solutions you used for your own projects.
Posted 15 years ago2008-10-06 09:24:06 UTC Post #256726
Does somebody know how to play a wav file ? I know there's some "playsound" command , but that's all I know :(
Striker StrikerI forgot to check the oil pressure
Posted 15 years ago2008-10-12 21:10:30 UTC Post #256990
I knew nothing about PHP when I started TWHL3
Really? Didn't know that.
I didn't know any PHP when I started making my first dynamic website. Now I use PHP every day.

My brother taught me HTML, and JavaScript and CSS I learnt from different web sites, but I don't see much difference in reading online documentations or getting instructions by a person, and reading a book.

Learing C(++) at uni should be similar to learning it from a book? At least that's the way I see it.
Oskar Potatis Oskar Potatis🦔
Posted 15 years ago2008-10-13 22:59:23 UTC Post #257020
I got into c++ by buying myself a book. I figured that I would probably be reading alot so it would be better to stare at a book rather than stare at a monitor.

Once you know one programming language, you have that "logic" and "mindset" and learning another language is just a matter of remembering all its commands and perks.

And I totally agree with Penguinboy, practical experience is the key, if you don't put into practice what you have learn't as you go, your not going to remember it well.
Posted 15 years ago2008-10-16 03:28:59 UTC Post #257182
Completely wrong, potatis. I have never read a programming book in my life, and I know several programming languages. Practical experience is a lot better than reading some stupid old book. I knew nothing about PHP when I started TWHL3, nothing about C# when I started Twister 5, nothing about Visual Basic when I started my first VB program, nothing about C++ when I started that, either. To be fair, I was taught Java, Assembly, C (and C++, but this was after my first C++ project) and Scheme at uni, but not from a book.
While I'd agree that good books are hard to find, there are still some good ones around. You're hindering your progress by ignoring them. I had been working with C++ for various years but only when I read 'Effective C++' by Scott Meyers did I learn various important things I had missed before.

Practice is indeed very important, but some theory to back it up is certainly not a bad thing. A variety of things can be picked up from on-line tutorials and articles, but many of these are of poor quality and you'll be missing out on some important stuff if you rely on on-line resources only. Certainly C++ is one of the more tricky languages.

And no, when you know one language it's not always a matter of learning a different syntax. Some languages are similar enough for that to make sense, but others can be radically different and will require a different mindset altogether. Which, I believe, is a good thing, as it teaches you how to approach a given problem from different angles.

@The(c)_Striker: you'll need an audio library (such as fmod) for that. However, since you're still quite new to programming, I would advise you to get more familiar with programming itself before jumping to such libraries.
Posted 15 years ago2008-10-16 03:54:22 UTC Post #257184
While it is very true that programming theory is important, a book on a specific language is not meant for theory, and will not give it to you. (Usually, because these books are nearly always meant to be reference books.)

A book on design patterns, for example, is much better than a book on the C++ language. Why, you ask, should you read something about programming that may only contain unusable pseudocode? Because, I answer, that these kind of books are the ones that will make you a better programmer, not reading through a reference guide. (only using patterns as an example, there are plenty of other topics out there)

People keep suggesting reference books, and I dislike trying to learn a language by reading a book. Theory-based books, on the other hand, are very good.
Penguinboy PenguinboyHaha, I died again!
Posted 15 years ago2008-10-16 05:20:53 UTC Post #257193
I'm not saying you should learn a language by reading a book - clearly practice is needed - but I am saying that, by disregarding language-specific books, you will hinder your progress.

Because by simply practicing, you may easily overlook things and draw wrong conclusions based only on the results you're seeing.

Yes, books on design patterns and other theories teach you things that are useful across language boundaries, I'm all for that. But if you're working with a specific language, then investing some money on good books about that language isn't a bad move. Call it reference instead of theory for my part (although I'm talking about more than just reference purposes), but this is an important aspect that many programmers seem to ignore. I'll admit, this is more important for a tricky language like C++ than an easier, more forgiving high-level language such as Ruby or Python, but we are talking about C++ here.

Let's put it this way: by learning from tutorials, you'll have to look for one each time you encounter a problem. You'll probably do some more searching on the side, so you'll encounter a few nuggest of information every now and then. If you buy a good book, you would get a bucket of nuggets, all nicely packed together. Sure, you might've gathered that by on-line research and other means just as well, but that often takes a lot more time than reading a good book. After all, reading is reading, it's simply that books combine a lot of stuff together.
Posted 15 years ago2008-10-16 05:26:39 UTC Post #257194
You have a point, but in my opinion, that kind of stuff is only appreciated once you actually know the language, not when you're just starting out.
Penguinboy PenguinboyHaha, I died again!
Posted 15 years ago2008-10-16 07:40:47 UTC Post #257200
Before I'm going to read these long texts I must tell you my book is : " C++ for beginners , by Brian Overland"

Well I did some programs , for fun . Some of then with commands that book never teached me . Such as "switch" .
I think I built a mini calculator once and an interesting program that calculates distance , speed and time based on s=d/t .
Now I'm going to read these long texts ...

[EDIT] Read that . You guys talk like professionals , really . Ok at first I didn't want to buy a book .Well after some days spending on reading tutorials from different sites I noticed this is a bad thing . Each beginner tutorial was just shit , couldn't understand nothing .
Contrary , the book starts by teaching me some general aspects of language programming . After that it exemplifies through a few pseudocodes . Well , after 20 pages , here's the Hello world program .
And the explanations are quite nice . It details what does every command do in that program . Then it gives you some exercises to practice .

I consider this book as a good start . I'm not reading all the day , only sometimes . At the moment , I consider programming fun .
Striker StrikerI forgot to check the oil pressure
Posted 15 years ago2008-10-16 13:03:10 UTC Post #257211
Read that . You guys talk like professionals , really .
I program for a living, so yeah.

Anyway, in the forums that I hang around on nowadays, the following articles and books are occasionally recommended:

C++ Language Tutorial
Correct C++ tutorial
'Thinking in C++' by Bruce Eckel

Perhaps you'll find them useful somehow. :)
You must be logged in to post a response.