Hello, c++ programmers

I am trying to understand C++ to the best of my ability but i could use some help on how to teach myself C++.

So i would like to ask you how you learned c++ (WHEN YOU FIRST BEGAN) i really want to know how c++ programmers personally learned c++. And also was it your first language your second, third etc.

Thank you so much c++ programmers for taking the time out of your day to read my post.
I began with GWBasic largely due to the fact it came with DOS 1.0. I would think of a simple application like temperature conversion. Then I would expand upon that to put conditionals in there, like limiting input between -40 to +50. In essence, I'd just dream something up and then try to build code that would work, and then improve upon it.

Soon I realized two things. (1) Interpretive languages are really, really slow, especially when it comes to sorting large amounts of data. (2) being limited to only machines that run GWBasic. It did allow me though to write one line of code and then immediately see the result. Such languages prompted one immediately if you code was syntactically incorrect. This did however get me in the habit of top down development, meaning I would do a small piece and then make sure every combination and permutation of it worked properly.

The most comprehensive application I wrote was in "C", but "C++" is brand new to me. Therefore, I'm taking a lot of code I've done before and some new stuff and implementing classes and becoming familiar with nuances particular to "C++". To that end C++ Primer 5th edition is something you might want to look into. It is an intensive read, but if your serious about application development or embedded system, I think it would be well worth your while.

As an example, this is how I start with top/down. Everything that is associated with reading an writing to disk, will be in "main". As you can see by lines 43 44 45, I avoid nesting code blocks any deeper than three levels before breaking into functions such as at line 41. The user can just simply type application name or with one argument which should be the filename to be used. Optionally the file can be created. The point is, in this block I've pretty much covered everything associated with files.

NOTE: I don't mean to advocate I'm using fstream correctly, but if there is a disk problem, it'll be easy to find the problem. If you do this and don't move onto more complex things until you completely understand the fundamentals, you'll be surprised how fast you'll learn.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
int main (int ArgC, char **ArgS) {
    string	FileNme = "Infom.dat";
	
	time (&Now);				// Seconds since 1-Jan-1970
	if ( ArgC == 2 )
		FileNme = ArgS[1];		// Replace with name passed by user
	
	// Initial display
	system ("cls");
	cout << "\n\tSession # [" << hex << Now << "] ";
	Data.open (FileNme, fstream::in | fstream::binary);
	
	if ( Data.is_open () )
		cout << "Processing " << FileNme << " ";
	else {
		char Response;
		
		cout << "Create " << FileNme << " [Y/N]";
		cin >> Response;
		
		if ( toupper (Response) == 'Y' ) {
			Data.open (FileNme, fstream::out | fstream::binary);

			if ( Data.is_open () ) {
				cout << "\n\n\tPlease enter following information:\n" << endl;
				GetOwnerInfo (Data);
				Data.close ();
			}
		}
	}		
	return 0;
}
I first learned BASIC in 1980s, then C/C++.

Try reading this:
http://www.programming4beginners.com/

I took a bit of an unusual approach.

I started with C++ and then learned other languages. This was both a blessing and a curse.

C++ is generally touted as being one of the more difficult languages to grasp conceptually, and having learned a decent amount of it before venturing into other languages made learning the other languages easier. However, not having a simpler understanding from learning other languages first made learning C++ more difficult initially. Thought, I will say that functional languages have proved more difficult for me to grasp, especially Haskell and Scheme.

Now that I've tried C#, C, C++, Java, Python, Racket, Haskell, and a couple others, I use C++ 75% of them time, C 20% of the time, and other languages the other 5%. The most comprehensive program I ever wrote was in C++ - a full Windows desktop application.

C++ is very fast, and very powerfull, and that's why I prefer to use it. You can do anything you can think of doing it, and you can generally be assured that till be fast (and the syntax makes sense to me, unlike Haskell's weird syntax). There are libraries out there for everything. I learned formally through school, and some self study. Many others here have completely taught themselves. I am not that gifted.

Please feel free to post questions here! We're always more than happy to help. We're on a programming forum for a reason :)

I know this website has some great tutorials. The website that Kevin gave is a great start.
JayZom said
I learned formally through school, and some self study. Many others here have completely taught themselves. I am not that gifted.

I've completely taught myself, but gifted isn't one of the things I would characterize myself with. I developed a really bad habit, of once I got something working or used a particular methodology, I stuck with that, only to realize sometime later, there was a better way.

So sites like this for those that don't have the opportunity for formal education are invaluable, because there are many participants that have the expertise that can point one in the right direction.
I think "gifted" wasn't the right word to use.

I could have learned myself, but I have difficulty learning without having others to help me.

I didn't know about this site until years after I started C++.

This site, and others like it, are, as you said, absolutely invaluable for those who are learning, both formally and self-studying. I enjoy seeing many on here gain an understanding a build from it. It's one of the reasons why I joined this forum. I'm always happy to share my knowledge and point others where they can find more.

I also have the same problem. When I find a method of doing something, I tend to stick with it.
you could probably get yourself off to a good start if you want to purchase a textbook that beginning college students would use like Introduction to Programming with C++ Third Edition by Daniel Liang. I dont imagine it will make you a "great" programmer, but it will get you started.
Topic archived. No new replies allowed.