Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


c++ basics


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
15 replies to this topic

#1 RaoulJWZ   Members   -  Reputation: 852

Like
1Likes
Like

Posted 05 July 2014 - 10:39 AM

Hey there everyone,

 

I'm into programming now for just a few weeks.

I started with Python and learnt some basic stuff, not very much, but some.

Now a friend of my asked if i wanted to do c++ with him and some other guys, and i know it is a hard language,

but i asked some around and almost everyone told me to do it, because learning in a group is way better then learning alone.

Tomorrow is our first meeting and today i wanted to know how much from what i've learned in python i could use in c++.

Those things are: input/output, if statement, else if statement, while and while statement.

I know it isn't very much but i want to know how much of the basics of c++ i've learned till now.

I understand that you could discuss about what the basics are exactly, so it don't has to be exact.

If it is possible i want to know to what i have to learn till i know those basics.

Thanks. Raoul 



Sponsor:

#2 EddieV223   Members   -  Reputation: 1520

Like
0Likes
Like

Posted 05 July 2014 - 12:57 PM

Try these video tutorials.

 

https://www.youtube.com/playlist?list=PLXjSIEICHR3OW7Ala0hkwNSrVE0uUpH6c


If this post or signature was helpful and/or constructive please give rep.

 

// C++ Video tutorials

http://www.youtube.com/watch?v=Wo60USYV9Ik

 

// Easy to learn 2D Game Library c++

SFML2.2 Download http://www.sfml-dev.org/download.php

SFML2.2 Tutorials http://www.sfml-dev.org/tutorials/2.2/

 

// Excellent 2d physics library Box2D

http://box2d.org/about/

 

// SFML 2 book

http://www.amazon.com/gp/product/1849696845/ref=as_li_ss_tl?ie=UTF8&camp=1789&creative=390957&creativeASIN=1849696845&linkCode=as2&tag=gamer2creator-20

 


#3 Misantes   GDNet+   -  Reputation: 1836

Like
0Likes
Like

Posted 05 July 2014 - 01:32 PM

Many of the concepts you've learned will carry over. Though, you'll still need to learn syntax and the little idiosyncrasies between the languages. If/else, while loops, input/output etc are common to many (if not most/all, I'm only familiar with a few so can't say for sure:P) languages, though  there are certainly some differences in the specifics of how they work. It will be things such as pointers and references, polymorphism, garbage collection, and such that sound like they'll be new concepts to you. They're "basics" of C++ but you'll still likely be learning things like loops and in/out for some time before getting into them. Maybe take a look at what the concepts are for pointers and references, but I wouldn't recommend trying to jump ahead without learning the "basics-basics". But, everything you've learned will certainly be helpful in picking up a new language.

 

The basics of C++ are similar to Python, and again, I don't think you'll hit any entirely new concepts until pointers and references, though perhaps I'm overlooking something. There will be little specifics that are new, such as in C++ variables not being in scope outside of a loop they're created in or the way functions handle arguments, but I don't imagine it will be anything you can't wrap your head around. Going from a high language like Python to C++ will take a little getting used to but should be manageable.

 

My Python is super rusty and I haven't practiced with it as much as I ought to lately though, so perhaps someone else will have different or better advice though :)

Good luck! smile.png


Edited by Misantes, 05 July 2014 - 01:47 PM.

Beginner here <- please take any opinions with grain of salt Posted Image

#4 xXDreamXx   Members   -  Reputation: 114

Like
0Likes
Like

Posted 05 July 2014 - 01:35 PM

If you are going to start C++ this is a great sourced http://www.cplusplus.com/ .  I personally am a mathematician, and I got majority of my heavy programming from this source.  Do not be discouraged by the language.  It is very powerful and is great for object oriented programming which is a very big thing now a days.

 

http://www.cplusplus.com/

 

The above link has great tutorials and also reference guides.  This will not only allow you to know how to use the coding syntax, but understanding what is going on behind some of the functions or code within the library.  It will be a big help when you start to manipulate data more.


Edited by xXDreamXx, 09 July 2014 - 08:35 PM.


#5 Alex G   Members   -  Reputation: 131

Like
0Likes
Like

Posted 06 July 2014 - 02:23 PM

All of the stuff you said you have done in Python will be similar in c++, however, you will need to get familiar with the syntax. As well as this check out the websites and videos the other guys told you to check out.

 

Have a good time learning! Hope it isn't too difficult. :-)


Edited by Alex G, 06 July 2014 - 02:24 PM.


#6 RaoulJWZ   Members   -  Reputation: 852

Like
2Likes
Like

Posted 07 July 2014 - 04:02 AM

Everyone thankyou very much your help is really appreciated!



#7 ngbeslhang   Members   -  Reputation: 170

Like
0Likes
Like

Posted 09 July 2014 - 03:22 PM

This actually depends on you.

E.g. I used to be starting to learn Java via books, but found it quite hard. Thus C++ actually seems easy to me. (It does.)

I decided to relearn C++ online (no, I only learnt like 2/3 from the book, especially the for loop kept confused me :/) so I introduce you learncpp.com. (I know, didn't updated for yeaes, but at least most of them are useful)
A C++ programming beginner from Malaysia.

#8 RaoulJWZ   Members   -  Reputation: 852

Like
1Likes
Like

Posted 10 July 2014 - 01:31 PM

thanks!



#9 Code Fox   Members   -  Reputation: 2253

Like
-1Likes
Like

Posted 10 July 2014 - 09:08 PM

A few things that will pop up when jumping into C++ from a scripting language...

1: If you want to use strings ( or don't want to write overly complex code to handle strings ) , better memorize this line of code
 


using namespace std; // some folks don't like using it due to "conflicts"

2: "<<" = output ... ">>" = input

// << is also the equivalent of + 
cout << "Hello World !" << endl;
// or
cout << "Hello " << "World !" << endl;

3: Variable types have to be declared !

4: Don't attempt pointers until you understand memory management "do s" and "don't s"

5: Learn how to write header files correctly

6: C++ classes do not quite work the same as Python's classes . C++ classes can be dangerous to new comers due to manual memory management requirements.


Edited by Shippou, 11 July 2014 - 01:30 AM.

A computer once beat me at chess,

but it was no match for me at kick boxing.

~ Emo Philips


#10 LennyLen   GDNet+   -  Reputation: 4468

Like
6Likes
Like

Posted 11 July 2014 - 12:49 AM


1: If you want to use strings ( or don't want to write overly complex code to handle strings ) , better memorize these 2 lines of code

 

It's not really a good idea to tell a beginner to use a line of code that it's generally considered bad practice to use. 



#11 tanzanite7   Members   -  Reputation: 1384

Like
4Likes
Like

Posted 11 July 2014 - 12:59 AM

Just to clarify what previous post is telling:

 

"using namespace std;"

 

... don't do that. Especially as a beginner - one benefits from clean namespace (not polluted with bazillion things a beginner does not even know exists from std and will bite him in the back). Etc: http://stackoverflow.com/questions/1452721/why-is-using-namespace-std-considered-bad-practice

 

I, personally, have never seen a necessity for "using namespace whatever" and consequently have never used it.



#12 LennyLen   GDNet+   -  Reputation: 4468

Like
0Likes
Like

Posted 11 July 2014 - 06:15 AM

Thanks for clarifying that.  I wanted to write more, but posting from a phone is so frustrating. ;)



#13 unbird   Crossbones+   -  Reputation: 7092

Like
0Likes
Like

Posted 11 July 2014 - 06:36 AM

Just out of curiosity. What do you C++ users think of this (using declaration vs. using directive). Is it still bad practice ?
 
#include <iostream>
#include <string>

using std::cout;
using std::endl;
using std::string;
// etc.
Edit: Meh, it's discussed in that SO thread too. Should have read first. I apologize.

Edited by unbird, 11 July 2014 - 06:47 AM.


#14 ngbeslhang   Members   -  Reputation: 170

Like
0Likes
Like

Posted 11 July 2014 - 08:04 AM

1: If you want to use strings ( or don't want to write overly complex code to handle strings ) , better memorize these 2 lines of code


It's not really a good idea to tell a beginner to use a line of code that it's generally considered bad practice to use.
I think I'll thank to my first C++ book (from Sams, I later found out their books are considered bad) for not telling me to add that statement.
A C++ programming beginner from Malaysia.

#15 Dalphin   Members   -  Reputation: 219

Like
0Likes
Like

Posted 11 July 2014 - 08:16 AM

Thanks everyone!



#16 dejaime   Crossbones+   -  Reputation: 4119

Like
2Likes
Like

Posted 11 July 2014 - 11:47 AM

using namespace std; // some folks don't like using it due to "conflicts"

It is definitely not about liking or not, I have already seen 4 threads of people asking for help fixing bugs caused by this. One had a variable called max inside a class but, since they had this line in their code, were actually referring to std::max. Also seen this happen with one that had a type called map to store the game map.
 
Even though we are lucky and the std namespace doesn't have that many typenames that we can conflict with (who'd create a type called basic_string?), this also applies to libraries that have their own namespace. Libraries with a lot of legacy code, or sometimes to comply with ANSI C, doesn't have namespaces; but it is getting more and more common to see libraries that do have.
 
When you make use of this using statement to bring the entire namespace into the global scope you kill the very reason they added it in the first place...

Just out of curiosity. What do you C++ users think of this (using declaration vs. using directive). Is it still bad practice ?

It is surely better, but even in this case one should never add this in a header file.

Edited by dejaime, 11 July 2014 - 11:50 AM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS