Hello everyone. I suppose I should start off with an introduction. I'm new to the whole C++ environment. I've done some scripting in perl, but just started with C++. I've picked up a few books and looked around on the web now for about 5 months. Finally came across this site last night. I don't have to much time to spend actually programming or reading because I'm currently in Iraq, but once I get back to the states I plan on using the military to pay for college. Going to go the Computer Science route.

I've read the messages posted here on the sticky section. I've already ordered the first book, accelerated C++. It should arrive in about 6-7 days. Currently I am reading the Sam's Teach Yourself C++ in 21 Days book. It's okay, but pretty bland. It also over uses source code examples, rather then just a snippet. This is just my perspective that I have gathered based on books I really enjoyed, such as the Llama, Alpaca, and Camel books for perl. What do you guys think of the Sam's book? Don't want to learn a style and then try to unlearn nasty habits..

The main thing I am having trouble understanding at this time, besides pointers and references of course, is the way variables and strings work. In perl, you had scalar and list context. Scalar data just meant single values, much like int, unsigned short int, or even char. List of course is for several, list styled values. These were stored in Arrays and Hashes. I've got a feeling most of the people here have at least a basic understanding of perl, so I am most likely wasting my time explaining this, but for my question I find it necessary to put the mindset I have right now out there.

This is all I've known about variables until C++. Now, C++ has several different types. Take Unsigned Short Int. It has a max value of 65,535 on my computer. To mean this is kind of unclear. I can see the reason why.. but how do you work around it in the programmers point of view? perl had no limits on size. This was never an issue. I'm also having trouble understanding Linked List, as well as strings. I don't expect a full explanation on these topics, but if anyone can point me in the right direction that would be great!

I've built a few programs and many many example exercise questions.. but none of them feel like they have any point to it. I kind of enjoy the examples I have found here, and can't wait to get to work trying some of them out in a few days when I get more free time.

Currently I'm using the Bloodshed Dev C++ compiler. I also have the MS Visual Studio 2005 Pro w/ MSDN Pro. Not really a big fan of MS line of products, but it was sort of a gift from my brother, so why not.. Main thing I do not like about VC7 is that it has way to many features in the IDE. I haven't messed with the command line to much, I use prefer to load up linux and run GNU with vim or if I am on windows use the Bloodshed. Maybe if I wasn't such new guy with C++, the VC7 would be nice.

Like I said, besides the books listed here and the questions listed, where else do you guys suggest to go for a really thorough tutorial, explanation, guide, and information source for C++? I can't really start taking classes for about 3-4 more months, so it's just reading and internet for now.

Thanks for reading, take care everyone!

Recommended Answers

All 6 Replies

i would say that you could pick an introductory {or intermediate} book and start reading...it will answer alot of your questions....also don't forget that programming needs alot of practise...

I've built a few programs and many many example exercise questions.. but none of them feel like they have any point to it.

i 've done a bit of perl{mainly for text editing} and it is true that you can do quickly a lot of stuff... in c++ it's different{at least in my case} because you have to learn the basics and then start using libraries to do really usefull stuff....

>What do you guys think of the Sam's book?
I don't trust any book that you can finish in 21 days, 24 hours, or 10 minutes or claims to be for dummies or idiots. They tend to gloss over important concepts (assuming the author is competent), but more often than not the author could use a bit more learning before trying to teach.

>Don't want to learn a style and then try to unlearn nasty habits..
Unless you have an ace C++ programmer who has a knack for teaching holding your hand the entire time and guiding your studies, you're going to learn bad habits. That's a part of the process, and believe it or not, unlearning bad habits can be more instructive than learning the right way from the get go. That's not to say that you should try to learn bad habits just so that you can unlearn them, of course. :icon_rolleyes:

>Scalar data just meant single values, much like int, unsigned short int, or even char.
Bingo. C++ just makes you pick them individually instead of lumping everything together into a scalar type.

>List of course is for several, list styled values.
C++ has the same thing, though lists are called arrays, and because C++ doesn't roll many types into one, you have a truly homogeneous list. That is, an array of int can only hold integer values. Heterogeneous lists are possible, but you have to take advantage of polymorphism or generics.

Also note that there's no native string type in C++, so an array of char is used to represent strings. So in C++ strings count as an aggregate type instead of a scalar type. That's an important concept to remember because it trips up a lot of C++ beginners.

>but how do you work around it in the programmers point of view? perl had no limits on size.
Perl (4 and 5, I'm not sure how the implementation changes in 6) does have limits on size because it uses C data types under the hood. You just never hit that limit, and if you choose your types wisely, you're not likely to hit it in C++ either. For example, if you're representing the age of a person, you don't really need the full range of a scalar integer (size_t, IIRC, which is typically an unsigned 32-bit value), right? It's reasonable to assume that an unsigned 8-bit char (0 to 255) can represent the possible age of a human until we get some really awesome longevity drugs.

>I'm also having trouble understanding Linked List, as well as strings.
Linked lists are fairly pervasive regardless of the language, and I'm surprised you haven't worked with them in Perl before. You can find a somewhat thorough dissertation on them using C-style syntax here. Strings are very very simple. They're just arrays of char with a trailing special character to mark the end of the string. The special character is called nul, and has the value 0, or '\0'. That's it. Just make sure your array of char ends with '\0' and you've got a string.

>I've built a few programs and many many example exercise questions..
>but none of them feel like they have any point to it.
It might feel that way, but any practice is still practice.

>where else do you guys suggest to go for a really thorough
>tutorial, explanation, guide, and information source for C++?
This forum is good. You really won't find a single resource that covers everything because there's just too much to cover. I'd recommend following the threads here as you'll find the majority of the problems beginners encounter and the resulting advice from very experienced and talented programmers.

Well, I understand what a linked list is, and what it's used for. I used perl for awhile, but mostly just for little things like formating text and such. I am just confused on how to implement it in C++. I'm assuming it's because of the material I have here to use as a guide, but I do have the Accelerated C++ book coming. Hopefully that will have a better way of explaining things.

I do not usually trust any thing that claims to work in a set amount of time. The book was 20 dollars though and I couldn't find to many books on Amazon that were designed for beginners or people who do not know much C. That's not to say that there isn't alot on there, but internet is slowwwww in Iraq and it makes it hard to do even basic searches.

Thanks for the advice. I really like this site alot so far. I will most likely play invisible for awhile, just scanning through threads and such, but it's really nice to know there is such a wonderfull community available if needed.

C++ so far seems to be amazing. There is so much to do, and so much to learn though. At times it almost seems like to much! I really can't wait till I'm writting full fledged programs. I got most of the basics down, it's just the reasoning behind the syntax that I can't figure out. I know how to use it and all, but why it's that way still seems unclear... I'm sure I'll figure out down the road. I really love all the control you have though!

Got to go for now. Thanks for the replies everyone.

>I am just confused on how to implement it in C++.
Then the link I gave should help. It's in standard C, but the code will work in C++ with minor changes.

>it's just the reasoning behind the syntax that I can't figure out.
Join the club. I write C++ compilers for a living, and I still don't understand the reasoning behind some of the syntax. ;)

Haha, well I wasn't sure if I was the only one who was boggled by the syntax but it seems not.

I've been working on a very primitive text based RPG for the last 3 weeks or so. Started it from an online exercise question and it has managed to hold my interest. I've got several classes laid out and such. As well, I'm using 2D arrays(Forest[x][y]) for the layout. It's very small as of now, but I enjoy it alot. I think I will be slowly progressing it as time goes. I do have a sort of strange question though.. I took a look at the VS2005 C++ WinForm app and it seems to add sooooo much code to the project. If down the road I wanted to add a menu system through the VS compiler, would I basically have to rebuild my whole project just to take it out of console mode? If so, is any of the code I have now reuseable? Also.. way down the road if manage to get into 2D graphics, will I again have to rewrite everything?

Speaking of 2D graphics and C++.. even though I am still very novice as of now, what kind of text do you suggest for just getting my feet wet so to speak. Kinda just test the waters, see how it's all do. I have never really looked into graphics programming, so besides knowing basic C++ it would be totally new to me!

I know this must seem like a bunch of trouble all the questions I'm asking.. but there is nowhere else I can find with such helpfull responses, and people who actually respond! Thanks for all the help Narue!

Also as soon as I get internet back on my laptop I will be taking more of a look at that link. Right now wireless is down so we have to all share one computer.. makes it hard to really do much besides post a fast reply and check email from family.

>I took a look at the VS2005 C++ WinForm app and it
>seems to add sooooo much code to the project.
Graphical programs require more code than console programs. That's just a necessary evil, but it might make you feel better if you knew what went on behind the scenes in a console program. ;)

>would I basically have to rebuild my whole project just to take it out of console mode?
Probably.

>way down the road if manage to get into 2D graphics, will I again have to rewrite everything?
I'm reasonably sure you'll choose to rewrite everything at that point.

>what kind of text do you suggest for just getting my feet wet so to speak
I'm not qualified to say. None of my work so far (beyond curiosity) has gotten into graphics.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.