I've been learning Python 3 for the last month or so, coding Algorithms for generating fractals shapes on a canvas. It's great and all, but I can't help feeling that there are other languages that would have more powerful tools for what I'm trying to do. Would C++ be a good option and how easy would it be to adapt to?
If you want to learn C++ you'll have to re-learn most paradigms, since Python's and C++'s way of handling instances is very different.
What do you mean by powerful?
Python is already a very powerful language in the sense that it provides quite some expressive syntactical sugar and a big standard-library.
I think that picking up a C language would be great for you. But C/C++ is pretty hard line compared to python. I'd go for C# instead!
[QUOTE=Corewarp3;40503446]I think that picking up a C language would be great for you. But C/C++ is pretty hard line compared to python. I'd go for C# instead![/QUOTE]
Everyone always goes on about how difficult C is, but I always found it to be one of the simplest languages to understand. It has a great syntax, and the only difficulty is remembering not to get fucked by pointers. You're absolutely bound to run into it at some point, so you may as well learn it sooner rather than later
[QUOTE=Icedshot;40510604]Everyone always goes on about how difficult C is, but I always found it to be one of the simplest languages to understand. It has a great syntax, and the only difficulty is remembering not to get fucked by pointers. You're absolutely bound to run into it at some point, so you may as well learn it sooner rather than later[/QUOTE]
When I decided to learn C++ I came from Pascal. I found the syntax of C++ extremely confusing. I had trouble with the fact that you could declare a variable wherever you wanted (that's not something you can do in Pascal, for those who don't know). At one point I nearly gave up trying to learn it, it just gave me headaches. Eventually I managed to wrap my head around it, and now about 8 years later or so I consider it my native tongue when it comes to programming languages.
If you have the patience, learn C/C++. It's fast, versatile, and very widely used. If you don't have the patience, C# is a great language, though it's not as cross platform as C++.
Then again, calling C++ [i]cross platform[/i] is a bit of an exorbitant. You can easily achieve C# cross platform-ism with Mono (and Xamarin).
It all depends on what you want to do with it.
[QUOTE=Kirth;40523901]calling C++ [i]cross platform[/i] is a bit of an exorbitant.[/QUOTE]
[url=http://gcc.gnu.org/git/?p=gcc.git;a=tree;f=gcc/config;hb=HEAD]totally exorbitant[/url]
I tried to learn C++ multiple cases, but i failed, but when i tried with C# i felt like home...
They're really not that different.
I don't see why anyone would have trouble learning C++ but not learning C#. Pointers and manual memory management are more advanced topics and are definitely not required when you're just starting. Other than that, it's pretty much the same.
[QUOTE=Kirth;40523901]Then again, calling C++ [i]cross platform[/i] is a bit of an exorbitant. You can easily achieve C# cross platform-ism with Mono (and Xamarin).
It all depends on what you want to do with it.[/QUOTE]
But doing it that way can be a bit of a pain in the ass… Writing portable C++ and just re-compiling it is generally simpler for both you and whoever ends up trying to run whatever it is you're doing.
I started to learn programming with Python in my school. After this I bought a C book to learn myself. I don't know why people say that is hard to program in C. It has a good syntax, is powerful and very fast.
Here's my opinion.
[QUOTE=Darwin226;40557603]They're really not that different.
I don't see why anyone would have trouble learning C++ but not learning C#. Pointers and manual memory management are more advanced topics and are definitely not required when you're just starting. Other than that, it's pretty much the same.[/QUOTE]
C# has the amazing .NET library.
In a way, that should make learning the language harder. Not really, but there's more stuff to learn.
In any case, it doesn't help you learn the syntax.
[QUOTE=Darwin226;40561734]In a way, that should make learning the language harder. Not really, but there's more stuff to learn.
In any case, it doesn't help you learn the syntax.[/QUOTE]
It makes everything a lot easier when it's all built in. Also, WinForms are a lot easier in C#.
What does any of these have to do with learning a language?
[QUOTE=Darwin226;40563029]What does any of these have to do with learning a language?[/QUOTE]
Learning a language isn't just about learning the syntax.
[QUOTE=supersnail11;40563173]Learning a language isn't just about learning the syntax.[/QUOTE]
Absolutely this. Learning syntax is easy. Learning standard libraries is what will really let you properly leverage a language.
Go for C# or Java. Both are much easier to learn compared to C/C++, and they have similar syntax and some of the same concepts without you having to deal with manual memory managment.
[QUOTE=supersnail11;40563173]Learning a language isn't just about learning the syntax.[/QUOTE]
So what you're saying is that learning C++ is difficult because it's STL is weaker than .NET?
[QUOTE=Darwin226;40570970]So what you're saying is that learning C++ is difficult because it's STL is weaker than .NET?[/QUOTE]
There are a few key differences. The STL is defined by templates and memory still has to be managed manually for the most part. There's much less of either in .NET, and don't forget .NET is not a C# exclusive. The point is C# is much easier to get into, but when you get down into it both C++ and C# are as powerful as you need it to be.
Learning C++ is difficult because it doesn't hold your hand as much as C# (although this is changing in C++ 11). Learning what STL and .NET bring to the table is the real learning curve.
I feel that you're missing the point. I'm saying that it doesn't make sense to "not be able to learn C++" and then say C# is easy.
C# holds your hand, C# probably has more beginner friendly tutorials, C# has a welcoming forms designer. All that's great. But how exactly is someone not able to learn C++ then, if learning C# is basically learning C++ with a GC and no pointers.
Point is, you don't read 600 out of 800 pages in a C++ book and then decide it's too hard. So how does one then open a C# tutorial and say "Oh, this is all so simple".
You're being semantic about the idea of "learning" the language. Learning a language isn't just syntax, and it's been said before and will probably hold true for a long time that once you learn the basic ideas of syntax you can learn almost any language.
C# is easier to get into, there is no denying that. It doesn't make C++ any harder, it just means that C# is easier to get into. But that's syntactically. C# and C++ share almost nothing except for syntax.
Just because you can learn all the grammar and vocabulary in Spanish doesn't mean you can speak Spanish fluently, and the same holds true for programming languages. Programming and software engineering are two different concepts.
I think it also strongly depends on the programmer's mindset, expectations and requirements. As OP is coming from Python's "simplicity", it might be more plausible and graspable to learn C#'s
[cpp]String myStr = myInt.ToString();[/cpp]
than C++'s
[cpp]std::stringstream s;
s << myInt;
std::string myStr = s.str();[/cpp]
or even C's
[cpp]char myStr[16];
sprintf(myStr, "%d", myInt);[/cpp]
This comparison is obviously about the way to do something and not how it is written syntactically, because they are all based on C and quite similar. Saying that C# is easier is limited to the facts that it (1) comes with .NET's huge library and (2) is syntactically more limited and guiding than C/C++.
Some people love the fact, that they can achieve complex things with minimal code in languages like C#, others hate to lose full control over what they are doing at the lowest level and stay away from such languages. Some people want to get stuff done with quick results, others are frantically optimizing the hell out of their algorithms. Some people need a Windows application, others are required to have extensive cross-platform support. This goes on and on, there are so many factors to consider for choosing which language to use for a certain task. OP should read about the use-cases for both and then decide which to learn (first).
I like C++ because I can do dumb stuff like this
[code]static string ToString(int value) {
string output;
std::ostringstream os;
os << value;
if (value >= 0)
output = os.str();
else
output = "-" + os.str();
return output;
}[/code]
and all you have to do is
[code]std::cout << ToString(myInt);[/code]
Same logic, simply shoved off into an include file that can be reused in as many projects as you need.
[editline]8th May 2013[/editline]
I work with C++ for school and C# for work so I've learned to love and appreciate both though. I think I have the most "fun" with C++ and I'm more efficient with C# which works out in my favor
[QUOTE=Protocol7;40571577]C# and C++ share almost nothing except for syntax.[/QUOTE]
I keep hearing this all the time. They're not that different at all, especially if you compare them with radically different languages like Haskell and Prolog.
[QUOTE=Protocol7;40571877]I like C++ because I can do dumb stuff like this
[code]static string ToString(int value) {
string output;
std::ostringstream os;
os << value;
if (value >= 0)
output = os.str();
else
output = "-" + os.str();
return output;
}[/code]
and all you have to do is
[code]std::cout << ToString(myInt);[/code]
Same logic, simply shoved off into an include file that can be reused in as many projects as you need.
[editline]8th May 2013[/editline]
I work with C++ for school and C# for work so I've learned to love and appreciate both though. I think I have the most "fun" with C++ and I'm more efficient with C# which works out in my favor[/QUOTE]
Right, but many people are asking why they even have to do this, why there is no simple toString() function right built-in as it is such an obvious task. Those people feel home in C# but not C++.
[QUOTE=ArgvCompany;40571898]I keep hearing this all the time. They're not that different at all, especially if you compare them with radically different languages like Haskell and Prolog.[/QUOTE]
C# is way different. C# manages inheritance differently than C++. At a runtime level, .NET languages use the CLR, which is a virtual machine with a built in garbage collector as part of the language spec, and C# assemblies contain metadata, whereas C++ does... pretty much none of that.
They're different beasts under the hood.
And yeah I was going to say C++ 11 does a lot of great stuff but it looks like ZeekyHBomb beat me to it before I could write it up.
[QUOTE=Dienes;40571811]I think it also strongly depends on the programmer's mindset, expectations and requirements. As OP is coming from Python's "simplicity", it might be more plausible and graspable to learn C#'s
[cpp]String myStr = myInt.ToString();[/cpp]
than C++'s
[cpp]std::stringstream s;
s << myInt;
std::string myStr = s.str();[/cpp]
or even C's
[cpp]char myStr[16];
sprintf(myStr, "%d", myInt);[/cpp]
This comparison is obviously about the way to do something and not how it is written syntactically, because they are all based on C and quite similar. Saying that C# is easier is limited to the facts that it (1) comes with .NET's huge library and (2) is syntactically more limited and guiding than C/C++.
Some people love the fact, that they can achieve complex things with minimal code in languages like C#, others hate to lose full control over what they are doing at the lowest level and stay away from such languages. Some people want to get stuff done with quick results, others are frantically optimizing the hell out of their algorithms. Some people need a Windows application, others are required to have extensive cross-platform support. This goes on and on, there are so many factors to consider for choosing which language to use for a certain task. OP should read about the use-cases for both and then decide which to learn (first).[/QUOTE]
C++11:
[code]std::string myStr = std::to_string(myInt);[/code]
Sorry, you need to Log In to post a reply to this thread.