Hello, I'm totally new to this and require assistance.

Pages: 12
Hello. I hope to one day refer to you all as fellow programmers. I'm new to this Programming thing but I am dedicated and would like to learn anything you can teach me, I'm looking through tutorials and i'm trying to get the main points of some of these terms, Not familiar with many of them to be honest, But hey, I'm sure we were all like me, A noob - At C++ at one time or another. If you'd like to help, I'd appreciate it very much, My Msn is Drkreaperr@yahoo.com - Feel free to add me, I look forward to our convos and such. Tata for now~
Although the other members of this bord migh want to harm me in one way or another for this post, I want to ask: why C++? I understand that you have not programmed so far. I don't think that C++ is a good language to start with. The reason is that it has too much facilities. You don't have to use them (this is what makes C++ so "powerfull"), but you will have to deal with them in one way or the other when you are in the "learning process", and be it that you read about them and say "nothing for me here" - you still have to read it.
Computer programming is not about languages. It is about the understanding of how computers work and what people want to do with them. And in my experience, people who try to learn two things at the same time (at this scale) learn neither.
In short, I'm pretty shure that if I had tried to learn programming with C++, that now I wouldn't be a capable of both, programming and using C++.
@exception
Well, I don't want to harm you, but I don't really understand what you're saying.

I understand the "nothing for me here" thing (for me pointers) but eventually they do make sense and you see how they are valuable. As for having too many facilities, I don't think that's a bad thing. It is a lot to absorb, but I think having too many resources is better than having less. You use them if you see a need for them.

Now I'm still new to this entire thing, (programming and C++, well HTML but that doesn't count) but do you mean by 'programming'? From my standpoint, "using C++" and "programming with C++" are pretty synonymous.

I came into the programming scene using C++. I actually tried Java, bought a book and stuff, but couldn't figure out the how to work the IDE. (I couldn't, and still can't, get anything to compile with any imports, aka #include's), so I turned to C++ just because it seemed more accessible. Also lots and lots of tutorials and cool forums like these =D

I think I've learned some important programming concepts from learning C++. (Object Oriented Design, operator precedence, the how-to of making something do what you want it to, polymorphism, scope, data-hiding? or whatever that's called, etc)

I'm just pleading my experience, that's why I'm not talking in a general manner.

I'm guessing you learned 'programming' before you learned C++, out of curiosity, how were you introduced to the programming world?

@Drkreaperr

Here's a good IDE (IMO). I've been using it since I started.

http://prdownloads.sourceforge.net/dev-cpp/devcpp-4.9.9.2_setup.exe

You can follow the tutorials, compile the examples and play around with them a bit. If you have any questions you can ask us here.
Last edited on
closed account (z05DSL3A)
Drkreaperr,

I have recommended this to others and had positive feed back, the book Code Complete [1] is worth, at the very least, getting out of a library and reading.

[1]Synopsis
Widely considered one of the best practical guides to programming, Steve McConnell s original CODE COMPLETE has been helping developers write better software for more than a decade. Now this classic book has been fully updated and revised with leading-edge practices and hundreds of new code samples illustrating the art and science of software construction. Capturing the body of knowledge available from research, academia, and everyday commercial practice, McConnell synthesizes the most effective techniques and must-know principles into clear, pragmatic guidance. No matter what your experience level, development environment, or project size, this book will inform and stimulate your thinking and help you build the highest quality code.Discover the timeless techniques and strategies that help you: Design for minimum complexity and maximum creativity Reap the benefits of collaborative development Apply defensive programming techniques to reduce and flush out errors Exploit opportunities to refactor or evolve code, and do it safely Use construction practices that are right-weight for your project Debug problems quickly and effectively Resolve critical construction issues early and correctly Build quality into the beginning, middle, and end of your project.
Last edited on
Mmmm. First of all, I'd like to thank you all for replying back. Uhh, Exception says not to start off with C++ So i'm a bit lost. Furthermore -"I'm pretty shure that if I had tried to learn programming with C++, that now I wouldn't be a capable of both, programming and using C++." Mistake me if i'm wrong but, I thought C++ is a Programming Language...So that there doesnt really make a bit of sense to me, As for you Mike, I'll check out those tutorials and whatnot, And I hope they help =]. I tried the tutorial on this site, The Hello World one and to be honest it wouldnt even run. Just to make sure I did everything right I copied the code off the site and pasted it, and it still wouldnt run, Maybe perhaps its my Dev-C++ Compiler, I dont know but oh wellz~ I made this program where it sorta acts like a calculator and you input 3 numbers, and it gives you the Avergage x]. Other than that, I'm a total noob at this =X
closed account (z05DSL3A)
Mistake me if i'm wrong but, I thought C++ is a Programming Language...So that there doesnt really make a bit of sense to me


I think what exception is getting at is that, learning to program and learning a programming language are not the same. In the same way that learning to write in English does not make you a novelist.

C++ can be complicated, learning how to program and learning a complex programming language at the same time can be off putting to some people. I university I attended started teaching the concepts of programming with Pascal, Modula-2 and so on, using the most apropriate language for the conept being taught.
Last edited on
I don't want to stop you if you want to start with C++. If you have your reasons than I think it is better to learn it if you really want to, instead of something you don't want to learn actually, just because you think it might help you with something else.


I think what exception is getting at is that, learning to program and learning a programming language are not the same. In the same way that learning to write in English does not make you a novelist.

I could not have put it better. And I think that if you want to write novels in a foreign language, you should learn both things seperately (in this case, first learn to write a good novel in your native language, then learn the language. Why? technicalities can always be learned, understood and then applied properly. However, if you understend a technical process in every detail, it does not mean that you have any idea what to do with it. I mean, why learn frensh if you don't know anyone who can speak it, too?)

The question remains: what is the "novel" and your "mother tongue" in terms of computer programming? This may lead to a philosophical debate beyond the scope of the question at hand, but let me try *my* answer.
- you have two variables, a and b. How do you change their values?
- you have the possibility to compare and exchange neighboring values in a sequence. How do you sort it?
For me, these are examples of "programming", i.e. the ability to write a "novel". In general, "algorithm design" might be an acceptable description.
Of course, you don't have a "native" programming language, however, when an algorithm is described, one often finds pseudocode. Which usually has a remarkable resemblance with (Object) Pasacal. For the sake of easier usage and GUI design, I therefore would use Delphi if I were a CS teacher.

Edit: typo. Feel free to correct the rest... perhaps *I* should start learning english.

Edit 2:
@ mikeb570: sorry, forgot to answer your questions.
Well, I don't want to harm you

You didn't. And even if you would have, I would like that more than if you said nothing just in order not to say something wrong. This *is* a discussion board, so I am here to hear about the thoghts of others. I have my own for the rest of the day.
As for having too many facilities, I don't think that's a bad thing

If it weren't for them, I wouldn't be using C++ now. But they are way to much to learn in one piece. And just imagine you can use, say, english, except for the ability to phrase questions. Would it still be english? So, if you "know" C++ except for the STL (or just the STL containers, not the algorithms, or except for generic programming, or whatever), would you still "know" C++?
out of curiosity, how were you introduced to the programming world?

Well, the very first experience still makes me feel dirty (it involved BASIC...) so I'm letting that out. I learned Delphi in school (my teacher was really good, I was lucky there... good teachers are rare), after about one year I looked at C++ for about two weeks, after which I gave up (until then, I already had used DirectX in Delphi and read a rather extensive book about Software Engineering my teacher gave me). Another year later or so I took a look at C++ again, this time prepared for a bit more to learn and understand. Since then, I have continuously tried to hone my skills, an ongoing effort which for about 8 years now (and I consider myself still far from "mastering C++").
Last edited on
I understand better what you meant now. I don't think C++ is the worst or best first language to learn. I just think you need to pay attention to some things may be told as bad practice and attempt to understand why. (goto's, non-const global variables, multiple inheritance).

The only other language I know anything about is Java, so I'll talk about that a bit. If Java was your first language, your forced to learn about OO in the very beginning. There's no way around it. But I think that's one reason why I shied away from it. I was learning about return types, parameters, objects/classes, private vs. public but not so much about the basic stuff. It just seemed like a bit much in the beginning. Plus I couldn't get the damn thing to compile either.

Whereas in C++, you learn about OO when you have a good grasp on loops, variables, functions etc. I've learned a lot of things from making stupid programs. Like what happens if you try to assign "ZZZ" to an int. But I never read anything (at least in the basic input/output tutorial) that explicitly what I should do about that situation. I think programming concepts come from experience and practice, which can be in any language.

You shouldn't feel dirty, I wish I had gotten into this earlier, I really do. I'm guessing you had Delphi in high school? Well, the closest thing my school has to classes on programming is "Computer and Business Applications" which is how to use Word, PowerPoint, Excel, and Access. (Which I took so I could spend more time on a computer in school. >.<)

@Drkreaperr

I'm guessing your "Hello World!" program is compiling (no errors) but it's shutting down as soon as it opens. Think of it this way, it's doing exactly what you're telling it to do, it's cout-ing "Hello World!" then it returns (closes).

You can put system("pause"); right before you're return statement, though you should read this for some alternatives and reasons why system() is bad. It may not matter much, but it's something to keep in mind. Controlled loops are the best way (IMO) i.e. close when you press 'q' or something like that.

http://www.cplusplus.com/forum/beginner/1988/

Here's two other tutorials that I like.

http://cis.stvincent.edu/html/tutorials/swd/
http://newdata.box.sk/bx/c/

I think it's best to cross reference between them. Hope that helps!
Controlled loops are the best way (IMO) i.e. close when you press 'q' or something like that.

That is *exactly* the kind of thing I consider "not good for novices". In Delphi, you would have had an GUI, and a program which is terminated when you press the 'x', just like you would expect. In C++, you have to care about that for yourself. (And I might add, such a loop, consuming 100% CPU ressources, is not a very elegant solution. That is no problem for your "Hello World", but it becomes a problem when it becomes a habit and you write "production code". I don't want such a thing in the programs *I* use.) IMHO the time worrying about such tedious things would be better spent learning about fundamental algorithms. (How many sorting algorithms do you know? What are the pros and cons about them? When would you use which one? I mean, sorting is one of the most basic things, but I get the impression that most people are so occupied trying to implement some fancy user interaction that they don't realize it)
Last edited on
An interesting thread this. I have to agree that learning to program using C++ is like learning to drive in an 18 wheeled truck. However if you are only ever going to drive an 18 wheeler then it makes sense.

One word of caution. When you learn C++ it will get worse before it gets better. When you first start out, everything seems as if it's not too bad, you are blissfully ignorant of what you need to learn. As time goes on and you start to learn C++ you start to become aware of just how much you don't know. Then as you continue to learn you will eventually climb out of his despondency but you will hit the bottom, everyone does.
Hmm "despondency" ...(adds to vocabulary) =)

@exception
I understand a continuous loop would not be good for "Hello World" but for something that requires input I don't see a problem with it.

For example
1
2
3
4
5
6
7
8
9
10
int main()
{
     char input;
     do{
           DoStuff();
           cout << "Again? y/n" << endl;
           cin >> input;
      }while(input == 'y' || input == 'Y');
      return 0;
}


...definitely not 100% CPU usage.

Let's look at my knowledge of sorting algorithms like this. If I wanna sort my deck of cards, I play FreeCell! And if I lose, I play again! On a serious note I don't know that much about sorting algorithms, I have read about them and know how a few of them work, and why they are good/bad.

I think most new people are not concerned with things like sorting algorithms at this moment. I know they are there, I know I could know all about them if I felt like reading for a few hours, but I don't really feel like it right now.

I think (again me and other people) who want to learn programming are simply dipping their feet in the water to see if they like it or not. If we like it, we'll stick to it, learning more and more stuff. Like as for me, I have over a year before I start college. I think I have plenty of time to learn about sorting algorithms whenever I feel like it (or see an immediate use for it).

AND SHUT UP ALREADY. I'M SICK OF TYPING!!

I'm joking, I like actually being involved in a discussion. (I just hope I don't sound like an idiot >.<)

@bnbertha
I like your analogy. But if you learn to drive an 18 wheeler (with no prior driving experience), wouldn't it be easier to learn to drive a car?

Also I've hit this "despondency" =) you talk about. I still find myself rereading a bit about pointers, though, according to my book I should have learned them before functions, classes and a bunch of other stuff I know about.


Last edited on
Well, your loop is not what I thought it would be (overriding the blocking mechinsm of the operating system. I've seen that a lot). Your loop is OK.
Let's look at my knowledge of sorting algorithms like this.

Again, I didn't mean to question your knowledge (so no public answer was actually excepted). As for your statement
I think (again me and other people) who want to learn programming are simply dipping their feet in the water to see if they like it or not. If we like it, we'll stick to it

Well. At university, in the 6th semester we were like 40% of who started. In the 8th, there were only ~25% left. I ask myself why this is - 15% quit after 3-4 years? My guess is, that they started programming "fancy stuff", where you indeed do not require any knowledge about algorithms. All you require is knowledge on "how to do fancy stuff". But then, suddenly, you realize that this sort of thing really doesn't matter. What do you want to do with your programming skills, once you got them? "Programming games" seems to be a common answer. Well, then here is a task every game developer has to face: "Given a set of points (for the sake of simplicity let's say in the plane), write an algorithm which outputs the convex hull of these points as a sequence of input points in counter-clockwise ordering". You need this in games for physics, visibility testing, mesh simplification and some other things. So, no matter if the approach you choose (there is a ton of algorithms which solve this problem in its lower bound time, Omega(n*log n)) does require sorting directly (e.g. a planesweep) or not, the result has to be sorted counterclockwise. So now you stand there, in the 7th semester, given this task. And what do you do? Quit, because you realize that all the fancy stuff you know won't help you any further and you don't even know basic searching algorithms? Because you realize that programming really isn't anything alike what you did all the time, thinking it is cool?

However if you are only ever going to drive an 18 wheeler then it makes sense.

Maybe. As I stated in one of the earlier posts:
If you have your reasons than I think it is better to learn it if you really want to, instead of something you don't want to learn actually, just because you think it might help you with something else.

However, I think that it is a Bad Idea to rely on one language. I think that grasping common concepts is an important step in becoming a good programmer (or computer scientist). Imagine you realize that you could use a functionality which calculates formulas given in a line of text. If you don't know yacc & lex, what are the chances that you learn to use these tools if you know "how easy it is" to learn a new language, once you have grasped the common concepts? Let's be honest, they are slim. So instead, you will sepnd more time writing buggy, unmaintainable, un-understandable code, for which you will need more time than you would have learning lex & yacc. (Again, this is my experience, and not an universal truth. But I invite you to think about it and be honest to yourself - what wouly *you* do?). Bottom line is: I don't know many people who drive an "18 wheeled truck" for their entire life, even if they may think now that they will.

An interesting thread this.

I agree. Furthermore a topic every new programmer should be aware of. Maybe it can be condensed once our discussion is over and put in some sort of FAQ.
I hate to throw a couple of pennies at you, but here's my 2 cents

I started C++ recently, with no knowledge of programming besides HTML.
However, my family (well, some of them) know other languages themselves, such as FORTRAN and BASIC. So, I'm not alone.

If you want to start C++, jump right ahead. IMO, you should learn it as it comes. You will find a helpful and educational community here.
Okay, This not only goes to you Qwerty, but to all of you as well. Thanks so much for your responses, I agree with Qwerty that this really is a helpful and educational Community. As for all of you, Wow, Where to start..Meh, I dont know xD. Perhaps I should read these responses a bit more. Perhaps some of you are right in saying that I shouldnt learn C++ first, It's logical to learn a basic, less advance language first that has some components of C++ so i'll benefit. By the way, Would any of you like to guess my age? If you get it right, I'll give you a cookie or two ^_^.

Edit: Oh and, Thanks Mike, You seem to be helping out a lot - Giving me those links to the tutorials and whatnot, I really hope I can master this language, I'll practice and practice. I have a bit of time on my hands (Summer, Yeyz!) My friend said that I should only learn C++ if I REALLY like it and want to do it for myself and whatnot. Yeah i've thought about it, and I have logical reasons as to why I want to learn this. And again, Wanna guess the age anyone? I'll raise it up to 3 cookies! x]]
Last edited on
I believe a fair lesson to learn from all of this is, learning C++ is fine, just don't forget about the big picture. After you get past the whole 'I've never programmed before, I don't know where to start' thing, remember that C++ is not the only computer language out there, so don't try to learn every little detail of C++. At that point, learn about programming concepts in general which are not language specific.

Your welcome, I try not to forget about the original poster when things go flying off on a tangent. Another thing, Google works wonders, really. Say, for instance, you can't get rand() to work properly. Google rand() c++ and make sure you're doing everything right. If you still have problems then post here. I only say this because some people come here immediately for help when their answer could have been 2 clicks away. Ya know what I mean?

Age? I'm pretty good things like this. Unless you were excessively young or maybe excessively old, I don't think you would ask that. And since you're in school, I'm going to say 12-13?
with no knowledge of programming besides HTML.

Well, let's stick with *programming languages* for the moment, shall we?

It's logical to learn a basic, less advance language first

What you cal "less advanced" I would in many instances call "less retarded". Consider the following example from H. Sutter:
1
2
3
4
5
6
7
8
9
String EvaluateSalaryAndReturnName( Employee e )
{
  if( e.Title() == "CEO" || e.Salary() > 100000 )
  {
    cout << e.First() << " " << e.Last()
         << " is overpaid" << endl;
  }
  return e.First() + " " + e.Last();
}

Assuming that destructors don't throw exceptions (they shouldn't), how many execution paths are there? That is, how many instruction sequences are possible when following the C++ standard? The answer is: 23. The point is: *NO* programmer is capable of thinking of all of them, at least not in the whole lot of his code. And not thinking of one of them means: an unhandled error might occur, your program will crash. There are only 3 execution paths if exceptions aren't considered. Do you really *need* exceptions? If not: your problem, they are there and you have to deal with it. Oh, and things become worse (*much* worse) if you use generic programming. Do you need it? If not - well, you know what I'm going to say already.

If you want to learn C++ properly, do me (well, mainly yourself) a favor: don't just try to learn it from the net. These self-declared experts writing the tutorials and answering your posts often write not-so-advisable things. My suggestion: get the "C++ Primer" first, work it through. If you want to stick with the language, get "The C++ Programming Language" as a reference. That should do the trick for the first 3-4 years.
These self-declared experts writing the tutorials and answering your posts often write not-so-advisable things.

You should take heed of this statement. To the best of my knowledge, no one on this site will purposely give you bad advice. I would hope that any bad code is picked up and flagged by someone else. The point is, most of the advice is born of hard won experience, from having to have addressed and worked through similar problems themselves. Their solution may be bad code but work through shear luck.
Don't take these posts as gospel. Query it, but most of all understand it. Don't cut and paste code from someone without understanding how it is doing what it does, how it fixes your problem. Challenge it and look for potential problems with it yourself.

Finally, in addition to the books above, take a look at the titles by Scott Meyers.
You should take heed of this statement

I didn't realize what I wrote and didn't want to insult anyone here - but what is done is done and I appologize. Let me try to rephrase my statement:
At work I have to use the code of others (either for maintenence, to add functionality or I have to code a layer above that given code). Since the "others" are mainly students or have their degree for <2 years, it is understandable that this code could be better. However, if one wants to write correct code, this foundation is quite unusable - destructors throw exceptions, const isn't used for anything, the stl isn't used (or not properly), printf which writes beyond it's bounds all over the place etc. When I then talk to the person who wrote the code, I usually get a statement like "C++ isn't so hard. I've learned it in less than a week from tutorials, and if I have a question there are forums where I can ask." Which leads to a certain hate for the tutorials and forums they use on my part. And when I recommend a book I usually get the answer "But you can't learn a programming language from a book!". Well, I did, and I most certainly did it better then them. I don't want to say that the people who wrote the tutorials and the answers to their questions write bad code on purpose. But I have to say that they do it for whatever other reason. And that reason is, as far as I can tell, that they are in the learning process themselves. Now this is fine, learning by teaching is a good concept I think, but they should correct their tutorials once they realize that they /could be better/. I should add that I didn't have a look on the tutorials on cplusplus.com, so please don't take my statement personally.
take a look at the titles by Scott Meyers.

Yeah, I forgot these. However, I would start with one book (e.g. the "Primer") before spending >100$ on C++ books just to discver after the first chapter that I don't want them...

OT
Don't take [...] as gospel.

Just out of curiosity for the english language: is that a commonly used idiom? I have never heared it before.
Last edited on
I've heard it before, but not commonly, so don't take my response as gospel. ;0)
@exception
I think you may have misinterpreted what I was trying to say, which is basically you have made a very good point, pay attention to it. The post may very well be correct, and on this site it usually is. That is usually correct and it is definitely not always correct.

Being from the UK ( I assume you are not), the 'gospel' idiom is quite common here. It basically means don't accept something as being absolutely correct, as an unquestionable truth. Question it and check it.

As tutorials and C++ reference documentation goes, I think this site is very good. Take a look because it is quite useful to be able to point some OPs to it sometimes.
Pages: 12