1,118 Posted Topics

Member Avatar for n_mehdi

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 …

Member Avatar for fayyaz
0
79
Member Avatar for damir_john

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), …

Member Avatar for JRM
0
149
Member Avatar for gcardonav

You can fix the second one by using [inlinecode]getline( myfile, msg );[/inlinecode] Enjoy!

Member Avatar for Duoas
0
127
Member Avatar for n_mehdi

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 …

Member Avatar for Duoas
0
78
Member Avatar for superseven

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 …

Member Avatar for Duoas
0
289
Member Avatar for gcardonav
Member Avatar for Duoas
0
201
Member Avatar for k2k

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; ... …

Member Avatar for Duoas
0
76
Member Avatar for wollacott
Member Avatar for Duoas
0
99
Member Avatar for MKQ

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 …

Member Avatar for Duoas
0
101
Member Avatar for CloudKill9

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.

Member Avatar for CloudKill9
0
108
Member Avatar for johndory

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 …

Member Avatar for Duoas
0
146
Member Avatar for MikeKristal

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 …

Member Avatar for Duoas
0
97
Member Avatar for lookin2know

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: …

Member Avatar for vijayan121
0
191
Member Avatar for darklich13

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.

Member Avatar for darklich13
0
205
Member Avatar for Lynxus

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 …

Member Avatar for Lynxus
0
110
Member Avatar for prakash.kudreka

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.

Member Avatar for Salem
0
91
Member Avatar for kux

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...

Member Avatar for kux
0
109
Member Avatar for kv79

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.

Member Avatar for Ancient Dragon
0
86
Member Avatar for Thew

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, …

Member Avatar for Thew
0
124
Member Avatar for olams

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 …

Member Avatar for olams
0
105
Member Avatar for XCal1ber

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( …

Member Avatar for Narue
0
267
Member Avatar for loushou

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 …

Member Avatar for Duoas
0
111
Member Avatar for starkman

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( …

Member Avatar for Lerner
0
637
Member Avatar for programmingme

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 …

Member Avatar for JRM
0
279
Member Avatar for loushou

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, …

Member Avatar for Duoas
0
100
Member Avatar for olams

[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]

Member Avatar for Duoas
0
67
Member Avatar for sigkill9

[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 …

Member Avatar for vegaseat
0
221
Member Avatar for olams

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 …

Member Avatar for olams
0
148
Member Avatar for shankhs

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 …

Member Avatar for VernonDozier
0
110
Member Avatar for Olsi009

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 …

Member Avatar for Duoas
0
2K
Member Avatar for altzaportu

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]

Member Avatar for Duoas
0
223
Member Avatar for seneye

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 …

Member Avatar for technogeek_42
0
176
Member Avatar for sheks1

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?) …

Member Avatar for Duoas
0
38
Member Avatar for Thew

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] …

Member Avatar for Duoas
0
96
Member Avatar for kako13

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.

Member Avatar for kako13
0
4K
Member Avatar for Conqueror_2

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.

Member Avatar for Duoas
0
93
Member Avatar for RossSCann

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, …

Member Avatar for Duoas
0
181
Member Avatar for Matt You

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 …

Member Avatar for Matt You
0
503
Member Avatar for blcase

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!

Member Avatar for Duoas
0
192
Member Avatar for AKJo

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.

Member Avatar for Duoas
0
297
Member Avatar for elisa751

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...

Member Avatar for Duoas
0
119
Member Avatar for VBNick

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!

Member Avatar for Duoas
0
32
Member Avatar for conan19870619

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 …

Member Avatar for conan19870619
0
94
Member Avatar for teppuus

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 …

Member Avatar for teppuus
0
138
Member Avatar for altzaportu

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...

Member Avatar for Duoas
0
132
Member Avatar for tootypegs

There is a form property called 'handle'. It is the HWND of your form.

Member Avatar for Duoas
0
301
Member Avatar for Thew

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.

Member Avatar for Duoas
0
205
Member Avatar for stackOverflow

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. …

Member Avatar for stackOverflow
0
321
Member Avatar for gusbear

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 …

Member Avatar for Narue
0
112
Member Avatar for Mr.popo

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?

Member Avatar for Racoon200
0
149

The End.