31 Solved Topics
Remove Filter I remade an equation-solver program from Java to C++, and I plan to post it soon but I would rather not until I can determine where modulus fits in with PEMDAS. To those who don't know, PEMDAS is the order in which mathematical expressions are to be evaluated. The order … | |
I tried implementing a template Array-class that allows initial size of global arrays to be known at compile time, specified by the user. When I specify a class of type <1, 1> size, the file compiles fine. However, when I specify a class of any other numeric type, in either … | |
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 … | |
Is there any real different between using an union between two types and a reinterpret_cast between two types, for example-- [code=c++] #include <iostream> int main(){ union{ unsigned short *a; float *b; }; float value = 0.6f; b = &value; std::cout << *a << std::endl; unsigned short *s; float *f; f … | |
I've read up to the point where the author explains partial classes. I understand the general concept - they're used when a class is so big that it is better to split it across files. I created two .cs files. Let's say one is CS1.cs and the other is CS2.cs … | |
Hi, my name is Alex. I'm fairly new to C# but apparently I may be required to know how to manipulate .NET Frameworks via C# so I am studying a beginners book and another book to thoroughly understand the language. The problem is that I am struggling to understand the … | |
Is the [X] at the top right corner part of the JApplet or container with the JApplet? I need to make an action happen when the user attempts to close out of the JApplet and I'm not sure of how to properly access the window-closed button within JApplet context. Thanks … | |
I'm having a Focus issue when running a Swing application. There are 4 buttons visible on the JApplet. I have an implementation that allows the user to make keyboard and mouse events in the JApplet. The problem is that I can use the keyboard and mouse events when the program … | |
I recently wrote a cpp file that I'm questioning. I'm unsure of whether the approach I took is correct or if it will cause damage to the heap. The goal of the project is to be able to do "clean-up" on dynamically allocated memory by storing the created object in … | |
I'm trying to create my own pattern (or something similar to a pattern I guess) where objects that are anonymously instantiated can still be referenced, but I'm getting weird memory results. It seems as if the free memory is decreasing when it should be increasing-- [code=java] import java.util.ArrayList; public class … | |
I've been trying to find time to learn Assembly through the HIDE HLA IDE, but I am completely ignorant when it comes to Assembly. I do not know if my code will be portable when I start learning it. Do other Assembly languages conform to the same standards, or is … | |
I'm having a small design issue with a Checkers game to be done in Java-- I'm not really worried about coding it, I can do that. The problem is listing out the dependencies between classes. For example, what should be responsible for what? IF I code the program with the … | |
How in the hell do you divide by 7 using nothing but-- ~, ^, >>, <<, &, | -- In a set algorithm. I'm stumped. I've tried mapping out different numbers dividing by each other... it didn't work. I would map out a number subtracting from the other to see … | |
Is it possible to send something like, a Frame or Applet to a target computer? If not, how would I set it up so that two users from two different computers could interact with the same JFrame or JApplet? Edit: No I'm not asking for code, just general advice* | |
I am wondering how one would append additional memory to the end of a pointer that already has memory allocated? For example, if I do something like this... [code=c++] int *intPtr = new int[5]; // pointer can be assigned 5 values of type int // Now I want to add … | |
I'm getting ridiculous results in my program! Seconds work fine Decaseconds (1/10 of a second) work ok Centiseconds seem a bit off Milliseconds are completely off... Here's the code-- [code=java] import javax.swing.*; import java.awt.event.*; public class Clock{ private Timer t; private long startTime = 0, finishTime = 0; private boolean … | |
I know this is a really sad question to ask, but please tell me... how and when should I ever use extern? I recall an example that Narue showed me but even if I read through the definition from MSDN.com as well as other sources, I still can't quite understand … | |
I'm a complete rookie with NetBeans, and that's unfortunate because this summer our Instructor wants us to use NetBeans throughout the entire course. I'd just like to know... how do I add existing files to a project? I've tried right-clicking the project folders to see if there was some kind … | |
The problem resides below - I'm trying to make a directive command that disable one constructor definition, or the other, based on the parameter of T. When I uncomment the block around the if statement, I get this error-- [ICODE]... missing binary operator before token "(" [/ICODE] --but when I … | |
Does anyone have an website they would recommend to me for learning Regex? I have tried using the Sun's tutorial on Regex as well as the Pattern and Matcher classes that use Regex but I am not quite understanding it. I'd like to use it to return the String values … | |
[code=c++] #include <cstdlib> #include <iostream> /** Test Class for learning template-metaprogramming */ using namespace std; template<int N> //General case for a number class ShowValues { public: static inline void show() { cout << "Start: " << N << endl; ShowValues< (N > 1) ? (N - 1): 1>::show(); cout << … | |
I'm getting a really odd error in my program. The lvl value retains its initial value if it's left alone, but when the program runs after you've assigned it a value it get's a ridiculous number... then the previous number after another assignment... and the process continues. Here's the code. … | |
I don't understand... I thought that it would be functional based on the logic, and I was fairly careful with my syntax but it's still not working. Sometimes values will compare to as being "equal" even though they're not. I'm using troolean compareTo method (an int, returns -1, 0 or … | |
I was working with my own "Vector"-like class and thought about something. If I use the [] operator and return a reference, is there any way to mark that indice when a value is assigned to it? For example.. if I want to make a trim function that removes the … | |
Whenever I try to declare a "Regular Expression" while including symbols like "+", "-", "*", the match is done based on how those operators work. Now, when I try to use the regex API via combining those operators with backslash or \Q and \E I get the error message-- "...Illegal … | |
I don't understand what is happening to my program... I have a feeling that private members are marked private for a reason, because I'm having a serious error with accessing base-class data types via inheritance and declaring friends within classes... If you run the test program after attaching the header … | |
Okay so I have a program that tests for collisions using a complicated and 80% accurate method, but I want 100% accuracy. Like someone posted earlier about shapes colliding into each other, I realized that there will be cases where my method wont work. However, I've looked into a calculus … | |
Correct me if I'm wrong but... Each time I declare an object without assigning it a value, I am instantiating it (so long as the valid constructors is called upon doing so--) like... [code=c++] Triangle tri1 (3, 4); [/code] and this object exists on the stackk but only for the … | |
The error is listed in the title and then commented in main (last comment). The program runs but once it encounters the bool expression I overloaded, it seems as if the program pauses. I have a feeling it's a stack overload due to the way my function operates, but I … | |
Ever since I have heard that you can generate classes during runtime (from say, a URL I suppose) and can use java.lang.Reflect to fire methods based on String input, I was wondering how the process is done? | |
Hello, I'm having an issue with a line of code that really doesn't seem that it should be giving me an error. Before posting, I've googled this error and looked at related links with no help whatsoever. Most of the "solutions" were for correctly-placed brackets or different names (since some … |
The End.