Got a lot of replies. =D Let's start with the 1st one.Out of curiosity, why are you abandoning Python? Not that you shouldn't learn C++, but there are a lot of uses for it where C++ is less forgiving. Since you can link one to the other, there's no reason you couldn't keep learning both if you like Python's structure/grammar.
I think Python doesn't allow me to do as many things as I'd want. Since I like making games or something of that sort, I'd need graphics, and since most people don't have Python, (And Python has 2 active versions, both are used about equally as far as I see.) they wouldn't be able to use anything I make, without getting it. I'm not going to bother explaining, why I wouldn't use 3rd party tools for having those 2 possibilities, that Python doesn't have. I do like Python's easy grammar/structure. Also, what's this about linking one to the other?
http://docs.python.org/extending/embedding.html this can get you started with using Python functions within C++, when you learn the prerequisites. Basically, the python interface (Python.h in the sample code) enables you to load up a python file and run the interpreter from within your C++ program, passing along whatever information you need to a function. From that function you can do whatever you want - build a whole game, call C++ functions by doing the reverse, whatever - and the C++ code will resume when the first function you called exits (without getting into threads). A lot of games will use multiple languages (including python) to share the strengths of each, particularly if they're intended to be moddable.
I'd say that if you're going to be learning C++, you're going to get used to using external libraries
Unless you want to code everything yourself, which is an exercise in frustration at the level C++ operates, though it can be quite interesting if you have the right mindset. C++ by itself does not have the kind of graphics support that modern games require either - its strength is that you can make that support yourself, on any hardware, but you're probably going to be using something like Allegro or Crystal Space for sanity's sake. With that in mind, Python does have libraries/tools for both problems you have with it - PyGame and Py2Exe come to mind.
Honestly, I'm not sure what you did there... <_< Go ahead and continue, I guess... >_>
The meat of it is the use of the ternary operator - in python it would be Blood = 100 if "V" in String else 0. Essentially, they're reallly, really compact if-else statements, with the left-hand side (100) being outputted if the conditional is true (String.contains() in Java outputs a boolean if a given string has a substring), and the right-hand (0) if it's false. So Blood would be 100 if "V" were in the string, 0 if not. Of course you don't have to use the else portion - just do like Blood = 100 if "V" in String else Blood. In my original snippet, it trims
if (type.contains("V")) {
Blood = (startpoint.Blood + endpoint.Blood)/2;
} else if (type.contains("D")) {
Blood = 0;
}
down to
Blood = (type.contains("D") ? 0 : Blood);
Blood = (type.contains("V") ? ((startpoint.Blood + endpoint.Blood)/2) : 0);
Cute little ternary operator, asking type a question :3