Forum: C++ Apr 29th, 2009 |
| Replies: 3 Views: 676 I think it would be more useful if one could pass the string into a method and have it return the number of question-marks found (as an unsigned int, or in extraordinary cases an unsigned long int). |
Forum: Java Apr 29th, 2009 |
| Replies: 10 Views: 965 If you post your files, people will be more willing to help because it gives them time to look at your logic and help you understand which steps to take to complete your project. |
Forum: C++ Nov 28th, 2008 |
| Replies: 8 Views: 833 void TestVector(Vector<double> v)
{
}
int main()
{
Vector<double> pd(5.6,3.4,2.4);
// use the cast operator works if copy ctor is not defined
Vector<float> pf = pd; |
Forum: C++ Nov 26th, 2008 |
| Replies: 9 Views: 2,730 You know, I've been wondering about this for awhile now myself.
Honestly you can probably get away with making some kind of regex or key to "compress" files with given values.
For example lets... |
Forum: C++ Nov 22nd, 2008 |
| Replies: 3 Views: 459 There is hope!
Use fmod to resolve the modulus between two doubles
#include <iostream>
using std::cin;
using std::cout; |
Forum: Java Nov 22nd, 2008 |
| Replies: 7 Views: 964 Unfortunately, the implementation of ArrayList<T> looks [something] like this--
//... necessary imports
public class ArrayList<T> extends List<T> implements Collection<T>, Serializable{
... |
Forum: C++ Nov 22nd, 2008 |
| Replies: 5 Views: 1,247 Hmm, try changing char to unsigned (if it exists @_@ )
-Alex
Edit: I am really tired #_#
I didn't realize I made the array back-asswards XD
XP |
Forum: C++ Nov 22nd, 2008 |
| Replies: 5 Views: 1,247 You can use the bool array as a "bit-position" array for the representation of a char.
#include <iostream>
using std::cout;
using std::cin;
using std::endl; |
Forum: Java Nov 22nd, 2008 |
| Replies: 7 Views: 964 You'll probably have to reposition your read-stream cursor after each object read, otherwise you won't retrieve the right byte value from the file to match the data type(s) for the Object you are... |
Forum: C++ Nov 20th, 2008 |
| Replies: 2 Views: 312 That means you are literally treating something that isn't an lValue as an lValue.
For example if a method doesn't return a reference to something, its possible that attempting to treat the method... |
Forum: C++ Nov 20th, 2008 |
| Replies: 14 Views: 1,197 Rep-worthy! XD
It's too bad I can't give you any more rep today @_@
-Alex |
Forum: C++ Nov 20th, 2008 |
| Replies: 14 Views: 1,197 I don't know why... but I found the first post amusing XD
But I'm laughing with you Beast! I promise! O_O
-Alex |
Forum: C++ Nov 17th, 2008 |
| Replies: 6 Views: 1,300 My apologies.
Apparently I missed the portion of your first statement "I cannot use anything else, rules are rules." Please forget my previous comment. |
Forum: C++ Nov 16th, 2008 |
| Replies: 6 Views: 1,300 You may want to consider this process--
-Pull in lines from target read file and store them in a stack<string>
-pop strings from stack and write them to file
That's if the strings need to be... |
Forum: Java Nov 12th, 2008 |
| Replies: 8 Views: 790 Chances are likely that your Instructor wishes for both your getArms and getLegs methods to return an array of Limbs--
Arm[] getArms(){
return arms;
} |
Forum: Java Nov 12th, 2008 |
| Replies: 28 Views: 1,737 If you work in an environment similar to mine, you'll have people telling you to "GIYF!" quite a bit XD.
If there is a term you don't understand, you should definitely study it. I find it much... |
Forum: Java Nov 10th, 2008 |
| Replies: 28 Views: 1,737 Reflection is a very specialized solution, much like the Java Native Interface, Remote-Method Invocation, Wildcards, Design Patterns, transient values, volatile values, concurrency, etc.
Don't... |
Forum: Java Nov 8th, 2008 |
| Replies: 28 Views: 1,737 Use either TreeMap (http://java.sun.com/javase/6/docs/api/java/util/TreeMap.html) or HashMap (http://java.sun.com/javase/6/docs/api/java/util/HashMap.html)
Dictionary is also an okay way to go,... |
Forum: Java Nov 2nd, 2008 |
| Replies: 4 Views: 652 http://java.sun.com/javase/6/docs/api/java/math/BigInteger.html
import java.math.BigInteger;
public class TestingBigInteger{
public static void main(String... args){ |
Forum: C++ Oct 31st, 2008 |
| Replies: 10 Views: 1,380 Here's something I managed to whip up thanks to your logic--
#include <iostream>
#include <string>
#include <vector>
using std::cout;
using std::cin;
using std::endl; |
Forum: C++ Oct 28th, 2008 |
| Replies: 8 Views: 943 I thought I had the specs right until you said down-right instead of up-right in your 2nd paragraph.
Maybe a picture will be helpful?
Also, what are you using to graphically display your... |
Forum: Java Oct 23rd, 2008 |
| Replies: 10 Views: 895 Yes, I am very sorry for mixing static fields and members. Fields execute once and only once when the first object of the type is created (otherwise if a program executed all static fields of all... |
Forum: Java Oct 23rd, 2008 |
| Replies: 10 Views: 895 static values are resolved at compile time, before objects are created.
A static member of a class is a shared location in memory between objects of that class.
Because static values are... |
Forum: Java Oct 22nd, 2008 |
| Replies: 12 Views: 1,776 It may be possible that Java won't support an image-type in future releases and therefore not provide Serialization support for it but that depends on what it is.
I remember getting warning... |
Forum: C++ Oct 19th, 2008 |
| Replies: 4 Views: 1,226 I personally consider code in a Driver Program to be cleaner when the logic of main is known before anything else.
Also, function declarations make code more readable because you know of the... |
Forum: C++ Oct 19th, 2008 |
| Replies: 4 Views: 1,226 void printmovie (movies_t movie);
Is a function declaration.
The definition exists elsewhere in the same file.
Short/Simple reason: C++ can be very linear. If you comment out the function... |
Forum: C++ Oct 18th, 2008 |
| Replies: 3 Views: 1,197 In C++, you can declare a function, constructor, or operator to accept a type by reference and not value.
For example, the declaration of the function--
void foo(int); |
Forum: C++ Oct 17th, 2008 |
| Replies: 4 Views: 404 You can't declare a method within another method O_O
You'll have to pull all of your other methods (add, subtract etc) outside of the definition of your simp method. Your simp method can have the... |
Forum: C++ Oct 17th, 2008 |
| Replies: 4 Views: 404 It never hurts to include your code (provided it's not too long! O_O).
Just be sure to use code tags @_@
-Alex |
Forum: Java Oct 16th, 2008 |
| Replies: 4 Views: 803 I don't believe Menus or certain 'Views' would be possible without some type of Composite structure, so a reference to a Collection (or more appropriately, a Composite) within a Collection is good... |
Forum: Java Oct 16th, 2008 |
| Replies: 4 Views: 803 Ok, let me see if I understand what you're asking.
Let's first determine what a collection is.
Collection (programming) - a structure that holds many objects of some type (in old versions of... |
Forum: C++ Oct 16th, 2008 |
| Replies: 2 Views: 1,218 I'd like to apologize...
the previous example can be forgiven for not implementing Node deletion (since OP has it defined), but can't be forgiven for forgetting appropriate Node declarations in... |
Forum: C++ Oct 16th, 2008 |
| Replies: 2 Views: 349 That would be the ideal way, but also a lot slower.
Question for the original poster - what is a word? Is a word like the definition of a Windows WORD, or is it any 32bit (unsigned) int, or what... |
Forum: C++ Oct 15th, 2008 |
| Replies: 2 Views: 1,218 You can't make a typedef out of an incomplete type, so the following would be illegal if NodeType is generalized--
typedef NodeType* NodePtr;
struct NodeType
{
ItemType item;
... |
Forum: Java Oct 14th, 2008 |
| Replies: 3 Views: 3,723 This managed to work for me--
import java.util.*;
public class TestClass1{
static String seatLayout = null;
static String fn = null;
public static void main(String... args){ |
Forum: Java Oct 14th, 2008 |
| Replies: 11 Views: 1,380 You could use a State Machine, or State Pattern based on how many times an object has been encountered, or the State of an object can depend on the type of object it encounters...
It may simplify... |
Forum: C++ Oct 13th, 2008 |
| Replies: 8 Views: 573 Here's an example of encapsulating a 2D vector and emulating the behavior or a 2D vector through a class--
#include <iostream>
#include <vector>
#include <cmath>
using std::cin;
using... |
Forum: Java Oct 13th, 2008 |
| Replies: 11 Views: 1,380 Would an Adapter be overkill?
I.E.
public class AdaptedA<T extends A> extends A{
private T myType = null; |
Forum: Java Oct 13th, 2008 |
| Replies: 11 Views: 1,380 Bah, disregard this post >_<
public <T extends A> void doSomething(T type){
if(type instanceof [SpecialNeedClass]){
// typecast only for this type
}
//... |
Forum: C++ Sep 30th, 2008 |
| Replies: 19 Views: 2,093 Correct me if I'm wrong, but doesn't the cavet ^ symbol in C++.NET mean that the type is actually a pointer?
List1.Add(Vec1()); looks fishy... Vec1 is a pointer-type, so doesn't that mean you need... |