1,118 Posted Topics
Re: Actually, you can't get around having a list of the words to find. Both an array of string and a linked list of strings are just as efficient. Unless you have to find more than 100 words or so on a large text, there is no point in trying to … | |
Re: There is no such thing as simple networking in C++. You are better off reading the game's documentation (there are command-line options to connect to a specific IP and port). Once you know how to connect exactly like you want by typing from the command-line (or in the Start->Run box), … | |
Re: You can fix the second one by using [inlinecode]getline( myfile, msg );[/inlinecode] Enjoy! | |
Re: Unfortunately, Windows Vista no longer supports the old 16-bit DOS subsystem. But, you aren't totally dead in the water. Take a look at [URL="http://www.dosbox.com/"]DOSBox[/URL], which is a very nice x86 emulator for 16-bit applications. (It was specifically designed for gaming, but it will work for your program also.) The only … | |
Re: Hold on. You'll need to make sure you have the right to distribute that program with your application. I'm pretty sure there are some Delphi PDF components out there. In addition to [B]fayyaz[/B]'s link, there's also [URL="http://www.primopdf.com/"]Primo PDF[/URL], which is pretty nice. In all cases, however, I think you need … | |
Re: [URL="http://www.daniweb.com/forums/post510545.html#post510545"]Link[/URL]. | |
Re: Just use a std::string: [code=C++] #include <iostream> #include <fstream> #include <string> int main() { using namespace std; ofstream writer; string filename; cout << "Enter a file name please> "; getline( cin, filename ); writer.open( filename.c_str() ); if (!writer) { cout << "Could not open " << filename << endl; ... … | |
Re: Please use code tags. Your code works fine for me. What's giving you trouble? | |
Re: The problem is that type [B]int[/B] does not have members named HeightinFeet and HeightinInches. Starting at line 108: [code] int temp; temp.HeightinInches = ... [/code] An [B]int[/B] is not a [B]Height[/B]. [B]Chandra.rajat[/B] hit it right on: your operators are supposed to work on your class. So, the + operator should … | |
Re: You need to watch your brace style. (The while end-brace should be at the same indent as the while keyword, based on your other braced blocks.) The loop never ends because you forgot to [inlinecode]cin >> x;[/inlinecode] at the end of your loop also. Hope this helps. | |
Re: In C and C++ the only time it makes a difference is with the increment and decrement operators, which each come in two forms: postfix and prefix. Here we have an integer: [inlinecode]int a = 42;[/inlinecode] Let's play with it: [inlinecode]cout << a << endl;[/inlinecode] prints 42 [inlinecode][COLOR="Green"]cout << ++a … | |
Re: Are you allowed to use a [B]vector[/B]? Or just an array? Whenever you find yourself doing the same thing over and over and over, it is time to use a loop. 1. declare my vector or array or whatever 2. while not done 2.1. get a number from the user … | |
Re: Please use [[I][/I]co[I][/I]de[I][/I]] tags. [B]average[/B] Your average template function itself is fine, but you did not overload it. You need to write [I]another[/I] average function that takes only two arguments. You don't typically need to specify the type when you [I]call[/I] a templated function, unless you have to. For example: … | |
Re: The line [inlinecode]cube[5];[/inlinecode] is just a number. However, since the array has only five elements and you are trying to access the [I]sixth[/I], you'll get a bounds error (or worse). Use a [B]for loop[/B] to set each element of the array to zero. Hope this helps. | |
Re: Are you saying that it takes 10 seconds for each [I]digit[/I]? Or for each change in numbers? If the latter, make sure you set the timer1.interval property to something relatively low, like 200 milliseconds. If the former, you'll get a better response by loading all the images [I]once[/I], then just … | |
Re: O-notation always covers the [I]worst[/I]-case scenario. I don't think you can get an algorithm better than O(n*n) without sorting. However, it is always possible to reduce the number of comparisons done. Things that work along the lines of a hash-table would probably work best. AFAIK. | |
Re: The STL file close functions don't throw exceptions. They will set the fail bit if pending output could not be written before closing, but that's all. The general rule is that file close functions should not throw exceptions... | |
Re: MSDN is a scary place to navigate. Google often makes it easier. Just type "msdn copyfile" and hit "I feel lucky" and you'll usually go right to the source. The result is a complete explanation and prototype for the function you are interested in. Hope this helps. | |
![]() | Re: Well, no one else is responding so here's my take. Mind you, I've never tried to do this so I can't claim I know everything there is to know about it. Windows is pretty particular about not permitting the exe file to be modified while the program is running. So, … ![]() |
Re: Well, I've just glanced over your code, so I'll run through the most obvious errors first, and give some useful suggestions, and see if that doesn't help. [B][COLOR="Red"]1[/COLOR][/B]. main returns int. [B][COLOR="Red"]2[/COLOR][/B]. You have not very well documented your code. In fact, it took me until I was reading through … | |
Re: Example of how to convert a string to (upper/lower/title)-case. [code=C++] #include <algorithm> #include <iostream> #include <string> #include <cctype> class lowercase { public: int operator () ( int c ) { return tolower( c ); } }; std::string toTitle( std::string s ) { std::string result( s ); if (!s.empty()) { std::transform( … | |
Re: The assembly line only points to where the IP was when the error was identified. (So it doesn't help.) In any case, the problem is that [inlinecode]unsigned char buffer[ n ];[/inlinecode] creates a variable (buffer) which is, by itself, a [I]pointer[/I] to a list of bytes. The number of bytes … | |
Re: This is actually easier than you think in C++ [code=C++] #include <iostream> #include <sstream> ... while (getline( eyetrack, line )) { if (line.empty()) continue; stringstream ss( line ); { string val; getline( ss, val, ',' ); stringstream( val ) >> x; } { string val; getline( ss, val ); stringstream( … | |
Re: For a simple mathematical equation (in other words, something that can be done in one or two lines), why do you need a function? To overload a function you have to have at least one of the following [list] [*]a different number of parameters [*]at least one corresponding parameter of … | |
Re: Yes, don't feel bad. This trips up a lot of people. The << and >> are always for doing text output. If you know any C they are comparable to the printf() and scanf() functions. In other words, they always convert numbers to/from their string representations. So, like [B]vijayan121[/B] said, … | |
Re: [EDIT] That said, I think you are mixing integers and arrays. [B]x[/B] and [B]y[/B] should each be an integer, not an array. However, like [B]vmanes[/B] said, knowing nothing about your [B]eArray[/B] class I could be entirely wrong... [/EDIT] | |
Re: [B]Vegaseat[/B], you really ought to try to give people an idea instead of just writing code for them. People learn better when they can solve the problem themselves. A little direction --a nudge this way or that-- is all that is needed. (It is more satisfying both to the OP … | |
Re: It looks like your code is a bit foggy on what it ought to be doing. Get out a piece of paper and pencil and draw yourself a linked list, complete with little arrows pointing from node to node. Then using the eraser and pencil change the drawing so that … | |
Re: Surely your professor has given you more information than you have given us? Is your application supposed to be text or GUI? Are you supposed to click on the keys? If so, what is supposed to happen if you do? Is this strictly Win32 or are you using some sort … | |
Re: Geez, [B]DimaYasny[/B], if you have no clue what he's talking about at least [URL="http://www.google.com/search?q=linked+list&afid=5052&s=&search="]Google it[/URL], instead of wasting his time with "what?". Whenever you want to "zip" two lists (whether linked-lists or not) you'll need to keep a finger in each source list, and alternately copy elements to the new … | |
Re: You've got the right idea. Use some other string functions to help better: [code=Delphi] for each book do begin if AnsiStrPos( AnsiUpperCase( book[i].title ), AnsiUpperCase( title1 ) ) <> 0 then ... end; [/code] | |
Re: You've asked one of those questions that starts flame wars. (Personally, I like [I]Pascal[/I].) [B]The real answer is: [I]it doesn't really matter[/I].[/B] You might choose one language over another based on what you have in mind to do with it. But if you just want to learn programming then pick … | |
Re: On the right, at the top of the forum, there is a box labeled "SEARCH". Type in "return array" and select "this forum" from the drop-down box. (The very first item returned has some good answers. [B]Dave Sinkula[/B]'s third response [post #7] is probably what you are looking to do?) … | |
![]() | Re: Yes, like [B]AD[/B] said, if you don't have access to the Delphi code then you are pretty much out of luck. The best way is to set up some form of IPC. [list=1] [*]You can create a parent-child pipe. [*]You can use windows messages. [*]You can create server/client sockets. [/list] … |
Re: You've got a [B]type[/B] problem. Always make sure you are handling the same type of things. An [inlinecode]int *foo;[/inlinecode] is the same as an [inlinecode]int foo[];[/inlinecode] But it is very different from an [inlinecode]int *foo[];[/inlinecode] (which is the same as an [inlinecode]int **foo;[/inlinecode] ) Hope this helps. | |
Re: No, you can't, because member functions take an extra, hidden, argument [I]this[/I]. You might want to check out [URL="http://www.newty.de/fpt/functor.html"]functors[/URL], which would solve your problem! (While you are at it, the entire [URL="http://www.newty.de/fpt/index.html"]Function Pointer Tutorials[/URL] site is worth a good perusal.) Hope this helps. | |
Re: I don't know about .NET, but the Win32 functions are all listed here: [URL="http://msdn2.microsoft.com/en-us/library/ms682073(VS.85).aspx"]Console Functions (MSDN)[/URL]. You will need to enable mouse input with [B]SetConsoleMode[/B]. You can read it using [B]ReadConsoleInput[/B]. Use [B]GetStdHandle[/B] to get a windows handle for the console input. Use [B]GetNumberOfConsoleInputEvents[/B] to poll for any console input, … | |
Re: Ah, the loop ends at the space because the string ends at the space. scanf stops reading input at spaces. So when you enter "1234 432" the userString gets "1234", and " 432" is left waiting to be read. If you want to get a string from the user try … | |
Re: An identifier and a string are different because a string is surrounded by double-quotes. [code=C++] Movie a( "Scorcese", "the Departed", "Drama", 151, "Leonardo diCaprio", "5 Stars", "2006" ); [/code] Formatted for readability... Have fun! | |
Re: 16-bit x86 processors divide memory into "segments". Typically, all your code must fit in one segment. The way around this is to use "[URL="http://www.google.com/search?hl=en&q=turbo+pascal+overlay&btnG=Search"]overlays[/URL]". Good luck. | |
Re: What do you mean by "static" and "dynamic" instructions? I don't see anything there worth 60,000 bytes. I also don't know how you could make a bubble sort any smaller... | |
Re: No. How close to the edge you can get is entirely dependent on the printer model. Many modern home ink-jet printers can get to 1/2 inch of the edge. You can get information about the printing area using the Win32 [B]DocumentProperties[/B] function. Good luck! | |
Re: Don't bother to save stuff you don't want. For example, if you only want the first and fifth items in a ten-item line: [code=C++] string line; // we'll read whole lines at a time while (inFile) { // get a whole line getline( inFile, line ); // skip blank lines … | |
Re: Change line 160 back to [inlinecode]currentWord->head = NULL;[/inlinecode] You know that is correct, so if something breaks then there is an error elsewhere. (It [I]compiles[/I] fine for me with the correct assignment.) For line 267, surely you don't mean to say that a std::string and a wordList* are the same … | |
Re: Add [inlinecode]writeln( ShortDateFormat );[/inlinecode] to your code and see if it reads something like [inlinecode]yyyy/m/d[/inlinecode]. Also please look again at [URL="http://www.daniweb.com/forums/thread103675.html"]this thread[/URL], down at the bottom of the first post where it says "Convert From A String". Sorry I've been so busy, altzaportu. I'll respond to you more later... | |
Re: There is a form property called 'handle'. It is the HWND of your form. | |
![]() | Re: TThread is an abstract class. You must override all purely virtual functions in the descendant class --in this case, you must override the Execute method. Place the cursor over the word "TThread" and press F1 to read more and find an example. Hope this helps. |
Re: I too fail to see how complaining about the OP's tools helps him answer his question. There is no need to give him/her a hard time. In the real world of capitalism, choice of toolset is entirely dictated by business concerns. Nothing else. Business [or school] issues dominate technical issues. … | |
Re: If you have two points: (10, -7) (3, 12) then how do you find the distances between them? The distances are: - distance between the x values (what you are looking for) - distance between the y values (or "height") - distance between the two points (the length of the … | |
Re: I am presuming you are on Linux. Try [code] #! /usr/bin/env python print "Success!" [/code] Hope this helps. [EDIT] Oh wait. I just re-read your original post. You want to double click the python file? What window manager are you using? |
The End.