527 Posted Topics
Re: 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). | |
Re: More details are needed. For example, what type of goal are you trying to achieve? Finding a low-running time way of printing your array or just getting the job done? [ICODE] The Iterative/Recursive approach T, V, E, D, A, B T is found V is found, V should be printed … | |
Re: Please use code tags... //place code statements within brackets "["code=java"]" // insert code here... "["code"]" Get rid of the quotes when doing this | |
Re: This approach was probably unnecessary, but I took it anyways. Try this-- [code=java] import java.io.*; public class DataInputFilterStream extends FilterInputStream{ public DataInputFilterStream(InputStream is){ super(new DataInputStream(is)); } @Override public int read() throws IOException{ skip(available()); return (available() == 0) ? super.read() : 0; } public char readChar() throws IOException{ return (char)read(); } … | |
Re: If there is already a class available that can search through all of the files on your System, why not make a Decorator class or a class that Maps files (or file names) to a number, and if the file is encountered again, replace the value with an incremented form … | |
Re: I have said this before, but... From the gas station... White chocolate, cheesecake, rootbeer, 1/2 shot Latte O_O From Starbucks, typically a White-chocolate mocha along with a butter-horn. And of course I always pay the maker of the coffee to drink it (if they start making weird faces about it … | |
Hey everyone! =) I'm starting an Application Development club at my college! However, there are a fair amount of programmers with multiple backgrounds who want to be a part of the club and partake in some of the Software we will create. Most of the people who are joining the … | |
Re: Since Christmas is coming up, I suppose I'll revive this thread =) And Christmas is nice! I always get what I want... ...a day off =P -Alex | |
Re: Here's an idea... Instead of buying Vista, wait until 2011 for [URL="http://en.wikipedia.org/wiki/Windows_7"]Windows 7[/URL] I'd rather wait 3-5 years for a new OS than invest in one that will become yesterdays news fairly soon. | |
Re: 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 creating. | |
Re: Most of your statements were so brilliant, I couldn't understand them! "[I]Shizah[/I] happens!" @_@ This is what I believe (in my honest opinion)- The entire world is going through a recession (and soon a depression). Many companies are going to take advantage of the banks' decisions of supplying more money … | |
Re: 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 reference parameter, and not through a return value from the function call? Correct me if I'm wrong. -Alex | |
Re: [code=c++] 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; // use the copy ctor works if cast operator is not defined TestVector(pd); } [/code] In the above example, Vector<float> pf = pd … | |
Re: 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 say you have a text document and it is set up something like this-- [icode] // … | |
Re: Is your Instructor's name Ron, by chance? -Alex | |
Re: 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 benefit of Composition? There are many. Let's say you need to … | |
Re: I'm not sure how you plan to pause a method from executing instructions within it without somehow pausing (or 'blocking') at a particular line in the method. If you don't want to use a while loop, you can make a conditional clause where the loop sends its data to a … | |
Re: There is hope! Use fmod to resolve the modulus between two doubles [code=c++] #include <iostream> using std::cin; using std::cout; using std::endl; int main(){ double x = fmod(4.5, 3.22); cout << x << endl; // 1 R 1.28, so 1.28 should print out cin.get(); return 0; } [/code] | |
Re: [QUOTE=TimothyKhoo;696207]no....i really need help here... i just duuno what to respond better than that....i knw this is just an easy stuff for you guys out there....but i am ashame with myself cause i cant even face it...i cant even do own part as a trainee...how the hell am i going … | |
Re: You can use the bool array as a "bit-position" array for the representation of a char. [code=c++] #include <iostream> using std::cout; using std::cin; using std::endl; int main(){ bool bits[] = {0, 1, 0, 0, 0, 0, 0, 1}; char c = 0; for(int i = 0; i < 8; i++) … | |
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 | |
Re: 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 with those @_@). For example, the iostream header … | |
Re: 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 | |
Re: 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 as an lvalue wont work since you're returning a copy of the actual object in which that … | |
Re: [icode] 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 { if(cur->info < 0) // if the member (of the object on top of the … | |
Re: 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 MingW compilers). Use Code::Blocks or Microsoft Visual C++ 2008 Express edition (recommended). … | |
Re: 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 performance is an issue. If performance doesn't matter, use a vector … | |
Re: [QUOTE=DJSponge;711675]Thanks to you both, I began a Python tutorial this weekend and so far I love it. "Hello World!" lol[/QUOTE] Yes, another person who is entertained, and not aggravated, by programming! =) Always keep that perspective, no matter how hard it is to learn something! You'll find programming very fulfilling! … | |
Re: Ok, where is the confusion really? An API that specialized in SMTP and POP3 or the concept of SMTP and POP3 protocols? -Alex | |
Re: I tried this (using MS Visual C++ 2005/2008) and it managed to work-- [code=c++] #include <iostream> using std::cout; using std::cin; using std::endl; using std::flush; int main(){ char str1[] = "Hello"; char* str2 = str1; str1[0] = 'M'; cout << str2 << endl; cin.ignore(); cin.get(); return 0; } [/code] -- however … | |
Re: Use stringstream if you want to append values to a string buffer on one line then extract the string later. [code=c++] #include <iostream> #include <sstream> #include <string> using std::stringstream; using std::string; using std::cout; using std::cin; using std::endl; using std::flush; int main(){ stringstream ss (stringstream::in | stringstream::out); string testing = "testing!"; … | |
| |
Re: [QUOTE=james_zheng;737344]you need to have the concept of 'object oriented programing' . [B]A behavior(function) is belong to a object, it can not exist seprately[/B]. just like a hand can not do anything if it is not a part of a body.... Thinking in this way you 'll get the idea. if … | |
Re: 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. | |
Re: 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 Menu's ). -Alex | |
Re: 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 listed in reverse order. If you have to reverse the strings and list them … | |
Re: Assumed solution-- [code=c++] #define Class class class Link; class Room; Class Space { //... }; Class Room : public Space { Link* l; //... }; Class Link : public Space { Room* r; //... }; [/code] | |
Re: Why not just create your own implementation of FTP by using Sockets and sending a collection of bytes from one application to another then have the receiving application write those bytes to a File (or FileDescriptor object if that is possible). Edit: Here's an Open-Source API that seems promising - … | |
Re: [QUOTE=BestJewSinceJC;731485]Is there any way that I can take a String and somehow use it as if its the name of one of my declared Objects? For example, if I have an Animal named germanShephard, is there some way I could say String gerSh = "germanShephard"; and then treat gerSh as … | |
Re: Chances are likely that your Instructor wishes for both your getArms and getLegs methods to return an array of Limbs-- [code=java] Arm[] getArms(){ return arms; } Leg[] getLegs(){ return legs; } [/code] -- however, something about the assignment suggests that your Human class doesn't simply hold an array of 2 … | |
Re: 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 uninitialized array of vertices. You probably meant to do something like this-- [code=c++] Graph::Graph(int num) : … | |
Re: [URL="http://www.daniweb.com/forums/thread90228.html"]Read Narue's post[/URL] Also, it may be more beneficial for you to ignore a specified amount of characters or ignore characters until a specified delimiter is met-- [code=c++] #include <iostream> using std::cin; //... int main(){ //... cin.ignore(INT_MAX, '\n'); return 0; } [/code] If you put cin in an error-state, you … | |
Re: Speaking of pizza, it's time to order one! =) Hmmm... let's see... I typically only order pizza with Pepperoni, Italian Sausage and rarely will I go for Supreme @_@ What are some other fairly good toppings (for pan-crust pizzas)? =) -Alex | |
Re: I tried to remake the program and provide examples in an attempt to reproduce the problem on Microsoft Visual C++ 2005/2008 compiler, but I different errors than the one I expected despite the tests-- [URL="http://groups.google.com/group/comp.lang.c++/browse_thread/thread/165fd677062f0d13"]Similar Problem here[/URL] [code=c++] /** * Assumed header file for LogBuffer */ #ifndef LOGBUFFER_H #define LOGBUFFER_H … | |
Re: You can probably get away with using one method, recursively until it resolves to an absolute base case. I'm sure you can because I remember someone asking this same exact question, except they had to use recursion. They eventually found a solution. | |
Re: Please use code-tags and proper indentation. I believe you meant to close your while loop and your run method before overriding paint-- [code=java] import java.awt.*; import java.applet.*; /* Part 0, CSC104 Assignment 2 Fall 08 * Where is Wall-e? */ public class Part5 extends Applet implements Runnable{ private Location ovalOffset; … | |
Re: Check out the stickies in this forum. You should get a lot of good references from them. -Alex | |
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 … | |
Re: This should be an easy project, until you have to create a command for executing an applet instead of a standalone application. Also executing packaged-classes might be a bit tricky. It will help if you ran some batch files (or possibly even shells for a UNIX box) to see what … |
The End.