In C++, we use #define to define macros. How can we do it in Java ?\nCan it be used as function like in C++? (for example : #define square(x)=(x)*(x)  )
217916
The define statment is a preprocessor statment that replace an argument with another argument.usually after #import.\nI'll explain in C \nEG.\n#define print printf\n#define x 16\n#define y a+x\nThe complier find those argument that matches and convert them into the constant/alogrithm/string that was #define.\nThe closest that I can come to making a define statment in java is\nprivate static final (int,long) that cause the agrument to be a contstant.\nI use a class to provide for the alogrithm though.\nIf you know how to #define in java Please add in Details :)
1731
With modern C++ compilers you do have the bool (note minuscules) type. You can declare it like this:\n\nbool myBooleanVariable;\n\nYou may assign literals to it (literals for the bool data type are 'true' and 'false'):\n\nmyBooleanVariable = true;\nmyBooleanVariable = false;\n\nYou may assign them the result of boolean operations:\n\nmyBooleanVariable = (a > 5) && (b < 2);\n\nYou may declare functions to return bool results:\n\nbool IsInvoiceCurrent();\n\nYou may also test for their values directly:\n\nif (myBooleanVariable) ...\nif (!myBooleanVariable) ...
554630
You can generate this in one line of Perl, Unix scripting, or a small C/C++ program.  Simply write one number per line from your program counter.  You may have to get tricky and use two long ints, but it's not hard.\n\n Realize that your document may be very large, and for most purposes, you don't need a document, just use the variable(s) in your final program.
271698
#include<iostream.h>\n\n  int main()\n {\n   int n = 5;\n   for(int i=1;i<=n;i++)\n   {\n    for(int j=n;j<0;j--)\n      cout << * ;\n    }\n }
458821
method is like a function if you familiar with c or c++.\nMethod is called like a function the same way you did in c or c++\nMethod in class is a method which associates with its data and other members like functions, objects, etc.\n\nWhile object method is a method which is invoked or called by the object as a referrence. It can also calls a method from another class, depending on your hierarchy, where the other class must either be on top(base class) or same level or at the bottom as long as it has the linkage. To do this, u must use a polymorphism technique (which mostly learn at the institute).\n\nPlease refer to the reference book for this --I'm out of my memory for this!! I've been graduated for a long time ago:)\nBut if you have a technical problem to be solved, you can ask me.\nThis is my email:-> k_mz79@yahoo.com
285622
The trick with C++ arguments (regardless of whether they are structures are not), is that C++ passes arguments by value. That is, it will pass the value of the argument into the method, not the argument itself. If you change the matching parameter in the method, the change will not be represented back in the calling method.\n\nPassing by value can also get expense. If the parameter/argument is large, as in a large class, the compiler may spend a lot of time and space resources making a copy.\n\nI recommend passing the parameter as a reference, i.e., add a & between the type and the variable on the method definition line. The rest of your code will look the same. Now, a reference to the argument is used in the method rather than a copy.\n\nThis solves the time and space resouce problem as well, but it introduces a new problem. What if you want to update the paremeter in the method? Then you place a const before the parameter type. This will allow a reference to be passed in without changing the value.\n\nGet a copy of Scott Meyer's first Effective C++ book. It talks a lot about how to use C++ well, and how you can screw it up royally if you're not careful.
181397
The short answer, C++ is object-oriented C.\nC# is Microsoft's answer to Java.\n\n\nC++ has classes and objects build into the languge.\n\nC# has no pointers, but does have garbage collection.\n\nI would learn C++ first.
159645
(0! + 0! + 0! + 0! + 0!)!\n\n\n0^0 is undefined.
625847
Yes, it is all the way that you use the header files, for a C++ program.\nI cannot help with the setup wizard, but if you make the header files unchangable, and have all the stuff you want to change in the definition files, then all you need to update is the definition files, not the header files.  All should be sweet, in theory anyhow.\n\nAs for changing the users data, if you do not change the format that is it held, ie, not changing the interface mentioned in the header files, it does not matter how you store the information internally in the program, as long as it still comforms to the interface.\n\nIf this does not make sense, then you need to do some study on the programming language of your choice.  If you do not already have a language, then there are many to choose from depending on what you want to do.\n\nHave a search on Yahoo! for programming languages, hopefully it will not give you too many results.  I small set of languages is provided here though.  C, C++, Pascal, Fortran, Java, Visual Basic, Visual C++, C#, J#, etc\nAll languages differ, as the purpose of the language is different.  Just like the language in a foreign land is different to your native land, as it caters for the local population.
584954
Hi, remember they are all different levels of programming.\n\nC/C++ are lowlevel programming styles\nC#/Java are higher level\n\nC++ could count as highlevel depending on the situation.\n\nOk, If you really want to learn programming... Start learning JAVA first. The reason I am saying this is simply because JAVA is very heavily supported, and somewhat has nice standards. The way a programmer thinks while doing java can help them learn other languages quickly.\n\nSo if you learn Java you could easily adapt to C# which would make Visual Basic really piece of cake!\n\nThe other difficulty now is C/C++, which is a different style of programming... Once you learned Java you wont have that much trouble with C/C++ until you end up learning pointers and callbacks :) But they are fun to use dont get ashamed :)\n\nSo the conclusion would be to learn Java at first and C++. C++ is much more advance since it is a STL Library which consists of many areas which would make you confused. By learning JAVA you could learn all the software aspect and learn about object oriented design easily. From any decent book you will learn about Arrays / Strings / Objects / Datatypes / Interfaces / Abstract / Heirachal / ect. And all those theory could be adapted to later programming languages.\n\nGood Luck on your learning!
42344
In C++ the header file (.h) or "spec" should include the definition for all of the external interfaces (i.e. methods called by other files).  The actual implementation of these methods should be in the body (.c file).  If you do this, when you change the implementation of a method in the body you only have to recompile and relink the changed file.
492283
I have used VB for years and as far as I know, it doesnt have dynamic arrays. VB was not designed to be used like that so it probably doesnt have a syntax for it.
161015
-> is the in-place dereference operator. It is most commonly used in OOP.\n\n$a->{'b'} is exactly the same as $$a{'b'}\n\n-> can also be used for 'method' calls with blessed objects.\n$a->function(); is exactly the same as module::function($a);\n\nAn 'object' is Perl is actually just a reference to a variable, usually a hash (associative array). As such, whenever you want to use an object, you have to dereference it (othewise perl doesn't know what to do).\n\nSee the following in perldoc:\nhttp://perldoc.perl.org/perlop.html - Perl operators\nhttp://perldoc.perl.org/perlref.html - Perl references\nhttp://perldoc.perl.org/perlobj.html - Perl objects\nhttp://perldoc.perl.org/perlmod.html - Perl modules
132516
How to work it? It's not very difficult. You just need to write your code and compile it.\n\nUnfortunately I can't send you anything, but you can check out my first source for more information.
666807
(she never SAID it was math)\n\nAt the 'end' of each example, the values in your variables 'a' and 'b'...\n\nEx 1: a = 2, b = 2\nEx 2: a = 3, b = 3\nEx 3: a = 2, b = 3\n\nYour examples 2 & 3 use pre and postincrementation, which is common not only in Java but most programming languages.\n\nExample 2 uses a 'preincrement' operator, so 'b' is incremented to 3 before its value is assigned to 'a'.\nExample 3 uses 'postincrement', so the original value of 'b' (2) is assigned to 'a' before 'b' is incremented to 3.
540835
char* or char[ ] types typically use a char value of 0 to mark the end of the string.\n\n however, "cout" will stop at this 0 automatically, so you obviously do not have a 0 at the end of the string.\n\n the best bet would be to not use a char* or char[ ] type at all, but use a STL::string type.  research the C++ standard tempalte libraries.  it has a string type with everything built in.\n\n  if you must use char* or char[ ], initialize your array to all 0's and never use the final size'd spot.  this is clumsy C programming though, not C++.  Use the STL in C++, it prevents many bugs.
287766
This is an identical java code for your C++ code,\n\n1. create a filename, say HelloWorld.java,\n\n2. Write in following codes,\n\npublic class HelloWorld\n{\n      public static void main (String args[])\n      {\n           System.out.println("Hello World");\n      }\n}\n\n3. Save it and compile it. Then open the class file using java.