Forum: C++ May 8th, 2009 |
| Replies: 6 Views: 420 Yeah, after realizing how tired I was I also realized that I never answered the original question.
the getline function is accepting characters for your string but it doesn't seem like you're... |
Forum: C++ May 8th, 2009 |
| Replies: 6 Views: 420 This may help--
#include <iostream>
#include <string>
#include <cstdlib>
#include <sstream>
using namespace std; |
Forum: C++ May 8th, 2009 |
| Replies: 1 Views: 555 Have you done any research on Search Engines and how they are structured?
Do you understand the benefits of using a HashTable for this assignment?
I guess a good start would be to create a... |
Forum: C++ Apr 29th, 2009 |
| Replies: 3 Views: 681 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: C++ Nov 29th, 2008 |
| Replies: 6 Views: 436 1) That's me intermingling Java and C++. There's nothing more to say there.
2) Nothing I disagree with, but I tried making a simpler example for the OP to follow. |
Forum: C++ Nov 29th, 2008 |
| Replies: 6 Views: 436 You'd be surprised how much programming and math are related! =)
In fact, before I wanted to program I pursued a math major with more of a background in creative writing. I don't know how but I... |
Forum: C++ Nov 28th, 2008 |
| Replies: 6 Views: 436 Hmm, parameters are typically a part of a method's call argument(s). I'm assuming the assignment requires you to create a method that has a reference parameter and returns the result through the... |
Forum: C++ Nov 28th, 2008 |
| Replies: 8 Views: 834 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 27th, 2008 |
| Replies: 9 Views: 596 By no means am I attempting to discredit any Instructor. The assignment is familiar to me - very similar to what I had to do in a C++ class.
-Alex |
Forum: C++ Nov 27th, 2008 |
| Replies: 9 Views: 596 Is your Instructor's name Ron, by chance?
-Alex |
Forum: C++ Nov 27th, 2008 |
| Replies: 6 Views: 2,823 Subtraction is technically the same as adding a negative, so there was no need to add a subtraction operator to the doOperation method. Conversions from subtraction to adding a negative are most... |
Forum: C++ Nov 26th, 2008 |
| Replies: 9 Views: 2,735 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 25th, 2008 |
| Replies: 5 Views: 807 1) My Answer: Composition ( I believe you meant to say Composition ? ) is a form of delegation in which instances of a class use, but may not have the same interface of a target object.
The major... |
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: 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: C++ Nov 22nd, 2008 |
| Replies: 4 Views: 500 From what I understand, as long as a file has C++ syntax in it, it can be used as part of a C++ project ( if its a resource file its a different story I suppose, since I haven't really messed around... |
Forum: C++ Nov 21st, 2008 |
| Replies: 9 Views: 552 Ah... I think I'm understanding...
So basically, for an octet byte (8 bits) the table would look something like this...
constant integral types:
(using this list as an example)
-char ... |
Forum: C++ Nov 21st, 2008 |
| Replies: 9 Views: 552 I'd like to know how the types are defined based on the platform.
I have heard that in C++ a char is always 1 byte and an integer is always 4 bytes on any machine, despite how many bits are... |
Forum: C++ Nov 21st, 2008 |
| Replies: 9 Views: 552 In C++, where are the header files that define the standard primitives and bitfields?
I would like to confirm something, if it is possible.
-Alex |
Forum: C++ Nov 20th, 2008 |
| Replies: 2 Views: 313 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 20th, 2008 |
| Replies: 3 Views: 323 If you have a finite number of values and they aren't going to change, you can get away with using a standard array instead of a vector.
This is only if you have a static amount of values and... |
Forum: C++ Nov 20th, 2008 |
| Replies: 3 Views: 306 The error codes are usually self explanatory, though with Dev-Cpp that can be a different story since the IDE is currently 'dead' (it works, but it is old and I believe it only deals with gcc and old... |
Forum: C++ Nov 20th, 2008 |
| Replies: 3 Views: 477 void delNeg(node * L)
{
node *cur = L; // cur points to accepted pointer
node *prev = NULL; // prev points to NULL
while(cur != NULL) // while cur doesn't point to NULL
{... |
Forum: C++ Nov 18th, 2008 |
| Replies: 6 Views: 605 Use stringstream if you want to append values to a string buffer on one line then extract the string later.
#include <iostream>
#include <sstream>
#include <string>
using... |
Forum: C++ Nov 18th, 2008 |
| Replies: 4 Views: 386 I tried this (using MS Visual C++ 2005/2008) and it managed to work--
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
using std::flush; |
Forum: C++ Nov 17th, 2008 |
| Replies: 3 Views: 392 If possible, please post the solution. |
Forum: C++ Nov 17th, 2008 |
| Replies: 4 Views: 1,038 |
Forum: C++ Nov 17th, 2008 |
| Replies: 7 Views: 1,567 Static isn't defined strictly for classes. Static implies that something is resolved at compile-time (or in Java, something is used for the first time (Static Fields)). If this is hard to believe,... |
Forum: C++ Nov 17th, 2008 |
| Replies: 3 Views: 776 Post the code please. I can see a few ways around this but it might be better to have a sense of the intent of the program before making a suggestion. |
Forum: C++ Nov 17th, 2008 |
| Replies: 10 Views: 6,267 The problem may be that the compiler sees a possibility of your .cpp file attempt to define something that doesn't exist, since your header file is conditionally defined.
You can make it, such... |
Forum: C++ Nov 17th, 2008 |
| Replies: 4 Views: 339 Assumed solution--
#define Class class
class Link;
class Room;
Class Space
{ |
Forum: C++ Nov 17th, 2008 |
| Replies: 6 Views: 1,301 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,301 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: C++ Nov 16th, 2008 |
| Replies: 7 Views: 1,567 Not quite.
You can have behavior functions via the 2nd and 3rd levels of polymorphism also.
The 3 (or maybe '4') levels of Polymorphism that I know of are-
1.) Virtual
2.) Static
3.)... |
Forum: C++ Nov 16th, 2008 |
| Replies: 3 Views: 528 You could also make a Menu class to encapsulate the banking operation. However, it might be better to specialize your Menu and give it a name (and make an 'abstract' base class Menu for general... |
Forum: C++ Nov 12th, 2008 |
| Replies: 2 Views: 600 It might help if you explain what your Graph-class is supposed to do.
By the way, what is your constructor definition supposed to do?
You assign numV to be 0 then you de-reference an... |
Forum: C++ Nov 11th, 2008 |
| Replies: 2 Views: 3,324 I was being overly cautious and explicit with the possible parameters for what a user enters, but since string constructors aren't marked explicit, it is possible that a const string object will be... |