527 Posted Topics
Re: You could just create your own collection-type, such as a linked list or a tree, to store your information. Edit: Also I think a StringBuffer is backed by an array for random-access character retrieval. | |
Re: [QUOTE=snoh7;711317]Mooky, how did you go finishing this Hangman project? If you have a working completed one would u be able to send it to me at SNIPPED. I have an assignment due that very closely resembles your hangman and am in need of help[/QUOTE] If you look very carefully, the … | |
Re: Hmm something looks fishy here... [code=c++] for (int n = 3; n <= 100; n++) { for (int i = 2; n < i; ++i) { newn = n % i; while(newn > 0) { cout << n << " "; } } } [/code] In the above chunk of … | |
Re: Just a note... I can already see some problems... You're not implementing the <string> header... On one of your later lines you're using something along the lines of... [code=c++]cin << value[/code] ...and that just wont work. Also please use proper indentation and code tags, or others may not be so … | |
Re: Anything Java can do, C++ can do (though there may be more instructions). In fact, C++ can do more than Java.... However when it comes to GUI implementations, C++ loses out unless you count .NET Frameworks and other non-standard libraries that support GUI application development under the C++ language. I … | |
My computer keeps restarting whenever I do something like view a stream-video or also do something else that is video related, i.e. playing Warcraft 3 FT. Sure it can perform fine doing either task (for about 5 minutes) but then the computer just shuts off without warning! Now at first … | |
Re: Correct me if I'm wrong, but doesn't the cavet ^ symbol in C++.NET mean that the type is actually a pointer? [code=c++]List1.Add(Vec1());[/code] looks fishy... Vec1 is a pointer-type, so doesn't that mean you need to call gcnew to properly instantiate that Vec? O_O [code=c++]List1.Add(gcnew Vec1());[/code] I'd assume. | |
I had a hard time understanding the concept of memory in a computer, but something my Instructor told me gave me some hope. He mentioned that memory isn't really created upon invocation of "new" in C++, and stated also that memory isn't really removed upon the invocation of "delete." I … | |
I typically don't post anything unless I have a question or comment... but I am still trying to understand Serialization for Network-Applications and I ran into a brick wall (repeatedly) during a project that required sending and receiving chunks of data from one Client to another. Be aware of using … | |
Re: Though Stephen has already pointed this out, you need to get rid of the access modifiers when declaring data types in your main method. The reason is because it is irrelevant for a method to have access specifiers within its scope when you are declaring local variables that will not … | |
Re: I believe Masijade had something like this in mind, though I could be a bit off-- [code=java] import java.io.*; import java.util.ArrayList; public class Driver { //--------------------------------------------------< main >--------// public static void main (String[] args) { //array to hold data //String[] Data = new String[0]; Driver D = new Driver(); System.out.println(D.loader().toString()); … | |
Re: Without looking at the code... I must ask... is it truly required for both vectors to be of the same type ( <string> ) to complete the assignment? Your if statement will almost always evaluate to be true because you're using the single = (assignment) operator as opposed to the … | |
Re: Yes, the fact that you can store items that aren't what other programmers may expect when handling the data. That and most likely issues in memory, though I can't confirm this. The only reason raw types are allowed is for compatibility between legacy versions of Java (before Erasure types) and … | |
Re: Give the assignment a try, and we'll probably help you @_@ | |
Re: I had to edit what you posted... the indentation got to me-- [code=c++] #include <iostream> #include <fstream> #include <string> #include <cstring> #include <sstream> using namespace std; void getfile (ifstream&); void input (ifstream&, int&, string*); void write (int, string*, int*, string); void createArray (string*, string*, int, int, string*, int&); void run … | |
Re: This is off topic, but I'm curious... Why did you use msiL implementation with unmanaged code? Why not purely managed or purely unmanaged? | |
Re: [QUOTE=zzmgd6;698420]Thank you for the reply, but wrong way, I believe you're showing pushing an array of character strings into a vector<string>. Regards.[/QUOTE] Not quite. It would be valid if your array consisted of const char* values because strings accept const char* (and also chars) as a constructor argument via the … | |
Re: How do you need your tokens to be parsed? An example... [code=java] public class TokenMaster{ public static void main(String... args){ String myReallyBIGString = "ABCDEFGHIJKLMNOPQRSTUVWXYZ\n" + "ALPHABETICAL!\n" + "SOMETIMES I FEEL I'VE GOT TO 'AH-AH' RUN AWAY, I'VE GOT TO... " + "'AH-AH' GET AWAY!!!\n" + "RING RING RING RING RING … | |
Re: [QUOTE=dickersonka;698124]I am working on a logger showing showing types and values for classes and sql statements (ie parameters in sql statements) From the example above I will need to show output as something like Long: null and BIGINT: null What is a possible recommendation to be able to do this? … | |
Re: Is there a reason you are using '/n' instead of '\n' ? Also, is there a defined expression for a string being equivalent to a char? If not then you could try line != "\n" instead, though I don't mess with file I/O in C++ too much so I can't … | |
Re: Why exactly does class B have to extend A? From an immediate glance I can see a potential cycle instantiation issue. Think about it-- 1) Class A, after static initialization, will instantiate a class B object-- 2) Class B extends A, so when a B object is constructed, the super … | |
Re: I do not recall the arrow keys having a virtual key code associated with them from standard C++. I think the only way to do it is through the OS interpretation of the virtual key code of the keyboard, though I could be wrong... [url]http://delphi.about.com/od/objectpascalide/l/blvkc.htm[/url] | |
Re: Remive the semi-colon by your while-statement and you should be in business =) | |
Re: Your reverse function looks suspicious. You are overwriting the initial element before you store it to replace the last element, so the data is unrecoverable and you will end up with a mirrored half-way reversed array instead of the entire original array reversed. The tmp implementation isn't helping because its … | |
Re: Previous: strings can only hold a certain amount of data, so I'd assume so. Have you considered using the non-standard rope to meet your data needs? Or possibly a vector<char> implementation? Edit: Actually my previous post might need some more investigation, so I'm omitting it. My apologies. | |
Re: You could create a class for the information that you read in (such as a Person class) and assign the attributes to data (i.e., a String for the line being read). Then make each Person object implement Comparable<Person> After generating the objects based on the data retrieved from the file, … | |
Re: This looks like C and not C++... Use C++ implementations-- [code=c++] #include <iostream> using namespace std; int main(){ cout << " Testing 123... " << endl; cin.get(); return 0; } [/code] | |
Re: [QUOTE=daviddoria;685535]I actually don't have control over glutMouseFunc [B](I mean I suppose I could edit the glut source, but that sounds like a bad idea)[/B] Why is it so much different to pass a member function than a normal function? Is there no way to do this without overloading glutMouseFunc? Thanks! … | |
Re: [QUOTE=waldchr;691109]It always comes up with an error: The Directory "C:\config_file_directory" doesn't exist. Dev-C++ will now quit, please create the directory first. I tried reinstalling the program but that also didn't work.[/QUOTE] Did you try using C:/config_file_directory instead? It may be that the \c is being mistaken for a special escape … | |
Re: [URL="http://www.daniweb.com/forums/thread142503.html"]Because I don't like to repeat myself[/URL] =P | |
Re: 160,000 elements in an array can be memory-expensive... so let's try to find a way to make things less expensive. First of all, what is the range of your points (what are they for, and what is the maximum number you're planning on using per coordinate)? If the point-value is … | |
Re: This is the C++ forum, so why would you use strcmp? You can use string objects. Include <string> and you can compare 2 string objects lexigraphically with the string.compare(string) method. I'm not near a c++ compiler atm, but the implementation will looks something like this- [code=c++] #include<iostream> #include <string> using … | |
Re: It seems to me that you have a set of values returned to you from a traversal order and you would like to reconstruct the tree? If you refer to this [URL="http://en.wikipedia.org/wiki/Tree_traversal"]Tree-pedia[/URL] link, you will see different methods of traversing trees and how they are mapped out with values =) … | |
Re: To make an example of the difference via implementation-- [code=c++] #include <iostream> #include <memory> using std::cout; using std::cin; using std::ostream; using std::auto_ptr; template<bool>class B; template<bool>class C; template<bool>class D; class A{ public: ostream& run(ostream& out = cout){ return out << "Class A\n"; } }; template<> // when true, run is virtual, … | |
Re: wxWidgets, qt, OpenGL, Ultimate C++, Win32 API, MFC (AFX), and I think .NET cover the general potential GUI implementations, though I'm sure there are more. | |
Re: What specific implementations do you need? Learning Java is quite the trial. To get a decent dosage of Java, I strongly STRONGLY recommend "Java, How to Program 7e" by Deitel & Deitel. But this isn't good enough. Simply learning the language and some implementations might not be enough. What if … | |
Re: Correct me if I'm wrong, but you are using the .NET Frameworks with C++, are you not? If you are, have you tried looking up information on individual Components in the .NET Frameworks the way you want them to? I was capable of compiling and running [URL="http://msdn.microsoft.com/en-us/library/system.windows.forms.splitcontainer.aspx"]this[/URL] example using Visual … | |
Re: I don't think it's the run method that isn't executing, Peter. I think the problem is that you are not submitting a Runnable target as the argument for the Thread to execute. I actually don't understand why the Thread class is not abstract if it allows one to simply give … | |
Re: [QUOTE=EDDYGATE;691760]I also just move from c to java and i found this book "java how to program sixth edition" very useful. you can e-mail me on <snipped email> so that i can send it as an attachment[/QUOTE] The Deitel and Deitel books are always awesome. I also, second the recommendation … | |
Re: The problem wasn't the import. It looked like the OP already had the import listed. The problem is that the Scanner class does not provide a "default" constructor for Scanner objects. For a list of proper Constructors for Scanner objects, refer to this [URL="http://java.sun.com/javase/6/docs/api/java/util/Scanner.html"]link[/URL]. The most common use for a … | |
Re: [QUOTE=VernonDozier;692724][B]push_back does NOT separate the line into words. That's a separate problem. There's more than one way of doing that and I don't know whether this is for a school assignment or not, or what you've been exposed to. As far as splitting the string into words, you may use … | |
Re: Ok, I'm slightly confused about what just happened in this topic... A fair amount of individuals stated that returning a reference of the actual object that represents the class is more preferable than returning a copy that has the reflected changes made on the object. Sure, for performance reasons, it … | |
| |
Re: [QUOTE=williamhemsworth;691666]>I like what your saying.... to be a good programmer we must love the program..!! To be a good programmer, you need to know how to make a program.[/QUOTE] Seconded. | |
Re: I joined Daniweb about 3 months ago, and during that time I started self-learning C++. Amazingly, a lot of knowledge of Java migrated to my understanding of C++ and vice-versa! By understanding pointers and references as well as learning the Object Model of C++, I started to better understand Java! … | |
Re: After running some tests I realized that somehow your transform is jumping between 1-22 on the (result?) matrice-- [code=java] import javax.swing.border.*; import java.awt.*; import java.awt.event.*; import java.awt.geom.*; import java.io.*; import javax.swing.*; import java.util.*; import java.lang.*; public class ColorForms extends JFrame { LeftPanel leftPanel; TopPanel topPanel; CanvasPanel canvasPanel; JSplitPane wholePanel, bottomPanel; … | |
Re: Vectors have an overloaded Constructor that allows two arguments... I do believe, in that scenario, the first argument is the initial size and the second is the default value for all values in the vector. [code=c++] std::vector<std::vector<int> > vec2(100, std::vector<int>(50, -1)); [/code] [URL="http://www.cplusplus.com/reference/stl/vector/vector.html"]Source[/URL] | |
Re: Are Model 2 projects allowed? Aka, MVC, JSP/JavaScript front-end, Servlet controller, Database back-end...? | |
Re: Maybe this will do the trick? [code=java] import javax.swing.*; import java.awt.*; import java.awt.event.*; public class Ball extends JApplet implements MouseListener { private MyThread blueBall[] = new MyThread[MAX_BALL_COUNT]; private boolean bouncing; // xUp, yUp //private int x, y, xDx, yDy; int ballcount = 0; final private static int MAX_BALL_COUNT = 20; … |
The End.