2 QUESTIONS FOR A BEGINNER

Hi all, I am new at c++ and I have 2 questions.
I do not have any programming experience, is it the right choice to begin with c++ or is java better ?
Another question, I am confused about what is string ? when to use string and when char ?
THANKS
You do realize this is a C++ forum, right?

Java is an easier language, which makes is harder for you to metaphorically shoot yourself in the foot, however C++ will give you a better understanding of how computers work as it is a bit lower level than Java. I would suggest C++ over Java, but that's my personal opinion.

Use a string wherever you'd use an array of characters. You can use a single char to store individual ASCII characters, but if you have words or sentences you need stored, use a string. That's a rule of thumb I use.

Happy coding!

-Albatross
thanks a lot for your help
I would recommend starting with Python and then going to either C++ or Java. (Both are similar but different, neither is "better" than the other.) Python is a high-level, dynamically typed, interpreted language. It is very easy to learn and to use. And the concepts you learn in that language will make learning C++ or Java easier.

A char represents a single character. A string contains a sequence of characters.
I don't know. I python might be confusing for beginners, because it allows you to write even messier code than C++ or Java do (and even in those you can create code monsters).
hanst99 wrote:
[python] allows you to write even messier code than C++ or Java


I disagree. You can write crap code in any language. The strange thing is, most Python programmers I have met write much more beautiful code in Python than the average C++ programmer does in C++. You certainly run into problems when you get a C++ or Java programmer trying to use the idioms of those languages in their Python code.

But when learning how to program the compilation model, the static type system, pointers and unchecked memory access really get in the way of teaching fundamental concepts to beginners. The fact that all of your array accesses are bounds checked in Python prevent endless hours of frustration. You can teach all of the fundamentals of procedural, object-oriented and functional programming techniques in Python, along with data structures and algorithms. You can also teach about introspection, meta-object protocols and other things that are impossible in C++ (and so-so in Java).

Once properly versed in the fundamentals of computer science and software engineering, one can delve into the intricacies of static types, natively compiled applications, unchecked array access and the many other wonders of "bare-metal" programming.
closed account (3pj6b7Xj)
Forget Python, learn LUA for a scripting language but Python can't hurt, except Lua is a whole lot better for scripting.
Yeah, I started out with lua. I especially like how easy it is to use arrays over C++. I never could get it into an executable file and either had to use lExecutor that offers an output but no input, so I never got to use it to its full extent or the console in http://www.lua.org/demo.html

On that site, theres sample code for sieve, hello world, account using metamethods, and a demo of _G.
Last edited on
mrfaosfx wrote:
Forget Python, learn LUA for a scripting language but Python can't hurt, except Lua is a whole lot better for scripting.


I disagree here. They both have their strengths and weaknesses and the only real advantage that is tapped into with Lua is its small footprint and speed over python.

See here for a nice comparison: http://lua-users.org/wiki/LuaVersusPython

Also note that while both are quite popular in AAA PC game development, Python has a considerably larger presence in the professional world... Lua is almost non existent in the US. My suggestion is to learn Python. There are also much more resources available for the Python user. Learn Lua later. Historically I always preach Lua as the scripting language of choice, but that really only applies to games.
Last edited on
Topic archived. No new replies allowed.