No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
12 Posted Topics
I'm not quite sure the difference between strcmp and == operator when comparing 2 different strings, I was told to do this but == works as well with less typing. [code=C++] if ((strcmp (a, b[i]) == 0)) { someMethod(); } else someOtherMethod(); _______________________________ if (a==b)) { someMethod(); } else someOtherMethod();[/code] … | |
Learning about all functions in <iomanip> and was testing out setprecision() and found that something weird is going on...? I did try to do a search on setprecision() limitatations or similar keywords but can't seem to find the right site... can someone please tell me what's going on? [code] double … | |
I can't figure how to get this going, for every object I create I want to add that to the existing array. I read about arraycopy but I don't know how to increase the existing size of the array and always end up with array out of index error... [code=java]A … | |
I need some advice on the way I'm should be doing something like this... My main GUI is composed of a JTable and query box for custom SQL user queries. I execute a SQL query, from the ResultSet, map the ResultSet an ArrayList<Object>, parse it to a tableModel class extends … | |
I've know that a pointer to some dynamic memory must be deleted to prevent memory leaks. Now if say a struct/array or some other data structure, each with its own dynamic memory parts. If that structure (class, file...etc) contains the data structure goes out of scope does that automatically free … | |
Is it safe to compare strings with == operator or is .compare recommended? One of my teachers said NOT to use the == operator and always use a function when available. The example given was somthing along the lines of "when cpu is under high usage the == operator behaviour … | |
I have like 5 classes, 3 of then need around 15 constants the other 2 classes need only 2 of the 15. I was thinking of having a header file to contain all the constants in header file and just include them in the header files of all 5 classes. … | |
[CODE=c++]string a = "hello"; char b[20];[/CODE] Other than a for loop to copy character by character over is there some sort of function to convert strings to non const chars arrays? I don't even know if it exists or not but some kind of non const cast for a.c_str() perhaps? | |
One function is pass by pointer which stores the reference, the other is just pass by a reference... are theses methods equvilent or does one method require more memory than the other? [code=c++]#include <iostream> using namespace std; void cubeByRef(int *num); void cubeByRef2(int &num); int main(){ int a = 2; cubeByRef(&a); … | |
I was wondering if it's possible to change or add values to enum types? Such as changing the string "This is a msg" or add additional value to the type test. May I have some tips? [CODE] public enum Test { VALUE("This is a msg"); private String x; Test (String … | |
I would like to make so that when you have a int and prompting user to enter some number for calculations... if the number entered is larger than a 10digits, my program wouldn't just crash or if the user enters a string... I havn't be taught any error catching stuff … | |
Ok, I new to this and haven't been taught exception handling yet but I would like my program to run without crashing when someone mashes the keyboard. I have declared an int x, and I don't want my program to crash when user inputs an char or more than 10 … |
The End.