I also love the pokemon movies but spirited away was the first anime type movie i had ever seen
Printable View
I also love the pokemon movies but spirited away was the first anime type movie i had ever seen
bounty-hunter: Global variables! Ouch!
lmao i thin i will watch everything that is listed on there. =D
They are hard to keep track of, and easy to use accidentally wrong. Because they can be seen everywhere in the code you may accidentally change its value where you didn't mean to. Or you may forget its name, and declare another variable with the same name in some other block, and possibly not know which one you're about to change. There's an aspect called scope.. But those are some practical reasons. Most likely they will work just fine for you in a very small project, but imagine you were working with 10 other people and everyone used global variables, then it would be likely that at some point you would start using colliding names with each other.
in a big project wouldn't you just use something that includes all of those into one variable?
Global variables are also bad because your making the CPU keep track of it all the time; bad if we only use it in a small part. They won't get mixed up if you properly define your variables every time. So if you're using an int or a string, then you should tell the CPU that in case the variable does already exist.
Also, in big projects you might use functions so variables don't collide. Functions aren't allowed to collide either, so the problem comes up again. Then we use classes, and group them in certain ways to keep organized. In the end, you'll be able to build a framework and include classes of functions only when you need them. Those are powered by local variables don't collide with other things. Just make sure you don't include two files with colliding functions. Then you end up with a fast, working program ;)
C# is easiest for working with things like that.
How exactly would i put in a command to open a file than close the one that was open
for instance:
[code]
if (s1 == "mm")
{
xxxxx
return 0;
}
what would i put where xxxxx is at to open a file. I want this piece of code to open another file.
I don't like big pieces of code because it makes it too hard when compiling.
alex, it's getting to the part where it's easier if you just read some tutorials, or a good book, and came back with specific questions when you have them. Helping out with a few compilation errors is one thing, handing out full blocks of code another, especially something like this that is so general you can't miss it if you google it. For example, a first try: "c++ file input", first hit, has it all. Yeah, it's that common.
"We're here to help, not to code it for you."
I don't know why they're common in Delphi, but in C++ they're considered one of the biggest crimes and often an indicator of a design flaw if you need them. C++ - object orientation - encapsulation.Quote:
Originally Posted by bounty-hunter
First of all i did try to look it up and i put in C++ file open and nothing worked. im trying to open an executable file which it doesn't like working with.
Second the reason i did ask here is because i couldn't find the open file block.
Third your not coding it for me. If you were i would have given you the code and said here help me with this so i can submit this to someone as my own work. No i am doing all the work im just asking someone because i can't find what i am looking for.