1,118 Posted Topics

Member Avatar for begin02
Member Avatar for Duoas
0
103
Member Avatar for zoner7

You could always initialize the board to be filled with [i]invalid[/i] values (like -1) which is excluded from all comparisons. Your modulus idea is good.

Member Avatar for Duoas
0
178
Member Avatar for jamesdietriq

This page on Wikipedia ([URL="http://en.wikipedia.org/wiki/MIPS_architecture#MIPS_Assembly_Language"]MIPS Architecture: Assembly Language[/URL]) is an excellent resource to begin with. Another useful resource is the [URL="http://chortle.ccsu.edu/AssemblyTutorial/index.html#part8"]Programmed Introduction to MIPS Assembly Language[/URL]. It has a couple chapters on Floating Point Data replete with important points and simple examples. You can also search the forum for additional …

Member Avatar for jamesdietriq
0
134
Member Avatar for Arctic wolf

On Windows, check out [B]QueryPerformanceCounter[/B]() and [B]QueryPerformanceFrequency[/B]().

Member Avatar for Arctic wolf
0
122
Member Avatar for VernonDozier

That's because you are actually creating two different [i]types[/i] of structure. In C and C++, arrays are something of a mixed bag. When you declare [inlinecode][B][COLOR="Green"]int[/COLOR][/B] a[ [COLOR="Red"]10[/COLOR] ][ [COLOR="Red"]5[/COLOR] ];[/inlinecode] What is actually allocated is [inlinecode][B][COLOR="Green"]int[/COLOR][/B] a[ [COLOR="Red"]10[/COLOR] * [COLOR="Red"]5[/COLOR] ];[/inlinecode] And when you access: [inlinecode]a[ [COLOR="Red"]4[/COLOR] ][ [COLOR="Green"]3[/COLOR] …

Member Avatar for Prabakar
1
2K
Member Avatar for hot.com

As this thread is more than two years old, I don't think the OP is too interested in the answer anymore... :X

Member Avatar for Duoas
0
82
Member Avatar for ~bleach~

I think you are kind of close, but you need to be careful about a couple of things. The first problem is that the variable [b]lookahead[/b] is local to [B]lexan[/B](), so your compiler should be complaining about lines 11, 12, 14, 23, 27, etc. The second problem is that you …

Member Avatar for Duoas
0
135
Member Avatar for yap

The problem is that an array declared as: [inlinecode][B][COLOR="Green"]int[/COLOR][/B] a[ [COLOR="Red"]42[/COLOR] ][ [COLOR="Red"]17[/COLOR] ];[/inlinecode] is not the same as [inlinecode][B][COLOR="Green"]int[/COLOR][/B] *a[ [COLOR="Red"]42[/COLOR] ];[/inlinecode] The first is a 2D array of 714 (42 x 17) [B]int[/B]s. The second is a 1D array of 42 [B]pointers to int[/B]. The [B]c_function[/B]() is looking …

Member Avatar for yap
0
287
Member Avatar for mistercow.pnoy

All you need is an array or [B]vector[/B] of items, say '[B]t_top_score[/B]', which you read from file, modify, then write back to file. [code=C++] struct t_top_score { string name; int score; friend ostream& operator << ( ostream& outs, const t_top_score& top_score ); friend istream& operator >> ( istream& ins, t_top_score& …

Member Avatar for Duoas
0
128
Member Avatar for somename

Numbers and strings are two different kinds of thing. You'll need to convert between them. Use [B]strtol[/B]() or [B]strtoul[/B]() to turn your string into a number ([B]long[/B] or [B]unsigned long[/B] respectively). Hope this helps.

Member Avatar for somename
0
361
Member Avatar for phalaris_trip

Wow, I'm really surprised to see [B]AD[/B] so boiled up over something like [B]goto[/B]. (I thought you were cool man.... *sniff* --- heh heh heh) Actually, you'll notice that [b]goto[/b] still exists in many modern languages. Why? Because it has its place. A rare one, but still useful. All the …

Member Avatar for Duoas
0
274
Member Avatar for Lordstr

You've got the right idea, except that you can't name your constructor or destructor something different than the name of the class. [B]TFP.h[/B] either [code=C++] class ToonFillPrint { public: ToonFillPrint(); // constructor ~ToonFillPrint(); // destructor }; [/code] or [code=C++] class TFP { public: TFP(); // constructor ~TFP(); // destructor }; …

Member Avatar for Duoas
0
90
Member Avatar for brk235

The suggestion offered you does exactly what you want. [code] int i = 3; string s = "pineapple"; cout << s << i; [/code] produces [quote]pineapple3[/quote]

Member Avatar for brk235
0
196
Member Avatar for Black Magic

In reality, almost all hardware does both I and O with the system. The difference is in how the device is integrated into the system. A keyboard is typically (and AFAIK, always) treated as an input device, so programs that interact with it through the keyboard device driver can only …

Member Avatar for Duoas
0
121
Member Avatar for Hockeyfreak889

In the most platform-neutral way, use [b]system[/b](). For Windows, you can also use [b]CreateProcess[/b]() or the [b]ExecProgram[/b]() macro. To save things to the desktop, you first have to know where it is. Use [url="http://msdn.microsoft.com/en-us/library/bb762203(VS.85).aspx"]SHGetSpecialFolderlocation[/url] Hope this helps.

Member Avatar for Duoas
0
109
Member Avatar for Gagless

@[b]shankhs[/b] You've got the right idea (for one way of doing it). You might as well give the last argument a default value: [inlinecode]bool rec(string a,string b,int i=0)[/inlinecode] You also need to watch your termination condition. If [b]a[/b] and [b]b[/b] have different lengths you may get an access violation. [edit] …

Member Avatar for William Hemsworth
0
1K
Member Avatar for manutd4life

We won't do your homework or reply offline. However, I can help you think through your problem. A number is a number is a number is a number, no matter how it is represented for us humans. 10 dec == A hex == 12 oct == 1010 bin. The only …

Member Avatar for manutd4life
0
350
Member Avatar for Eriodor

There are numerous types of [B][I]memory[/I][/B]. There is external memory (stuff stored elsewhere like on disk or over a network or the like). Everything else I'll say here relates to internal memory: memory your computer has direct access to. There is RAM -- Random Access Memory, which is accessed via …

Member Avatar for Duoas
0
80
Member Avatar for lahom

Is this homework or workwork? What is the application? Semantics is a pretty broad field. In a very [i]small[/i] domain, you can track semantics, but if the programs are very disparate in design then you are going to have a pretty tough time. I suggest you look into [i]lexical analysis[/i]. …

Member Avatar for Duoas
0
73
Member Avatar for Run.[it]

Your loop encompasses both the menu and the selector, as: [code] do { display_menu(); select_option(); while (!done); [/code] So if the option is bad, the menu gets displayed again anyway. What you'd probably like instead is something that catches itself. You can do it several ways, but another loop will …

Member Avatar for Run.[it]
0
144
Member Avatar for Jennifer84

Standard containers don't actually free memory they use (AFAIK). You have to replace them. One way to do that is to swap it with itself: [inlinecode]v1.swap( v1 );[/inlinecode] I am shocked, however, that a 1.5 MB datafile uses 20MB memory. How exactly are you storing the data from the file?

Member Avatar for Jennifer84
0
128
Member Avatar for anbuninja
Member Avatar for Gagless

You're getting a stack overflow on windows? Are you on Windows 98 or something? In any case, make sure you don't multiply too large of a number. It costs a lot more than you think in stack space to call a function, so it adds up fast. The reason you …

Member Avatar for Gagless
0
152
Member Avatar for mmx64

Hmm, sorry. I thought I responded to this already. You'll have to set the [b]DefaultDrawing[/b] property to [b]false[/b], and provide a method for the [b]OnDrawCell[/b] event. Here's an example I googled. [url]http://bcbjournal.com/bcbcaq/index.php?loc=grids&caq=48[/url] (It is in BC++, but all the essentials are the same, so you shouldn't have any trouble reading …

Member Avatar for mmx64
0
3K
Member Avatar for mel1

I'm sorry but I don't see the logic error here. Did you actually cut-and-paste this code in or did you eyeball-to-fingers type it in? (BTW. Please use [[b][/b]code[b][/b]=Delphi] ... [[B][/B]/[B][/B]code[B][/B]] tags.) A couple of observations: 1. [B]ComputerWord[/B] should be filled with uppercase letters, but you are using a lowercase 'a' …

Member Avatar for Duoas
0
98
Member Avatar for L31chH4rdT

Of course, once you get the whole line, you'll want to parse it using a stringstream and getline() again... [code=C++] #include <algorithm> #include <iostream> #include <sstream> #include <string> using namespace std; char morse_decode( string letter ) { ... } bool is_multiple_spaces( char a, char b ) { return (a == …

Member Avatar for Duoas
0
311
Member Avatar for petzoldt01

[URL="http://www.unixwiz.net/techtips/remap-pipe-fds.html"]Link[/URL]. Enjoy!

Member Avatar for Duoas
0
351
Member Avatar for yap

IMO, interfacing with the user is one of those things that needs to be absolutely bullet-proof. There are two things to keep in mind here: 1. How does the [i]user[/i] expect to interact with your program. 2. How does your program react to insane responses. Answer 1: For console applications, …

Member Avatar for tesuji
0
2K
Member Avatar for Cybulski

The problem is with types and initializer syntax. Make sure that an empty OPTIONS is [inlinecode]{ string(), vector<string>(), 0 }[/inlinecode] NULL is not a valid vector<>. Hope this helps.

Member Avatar for Duoas
0
107
Member Avatar for WesFox13

Heh heh heh.... You're going to love this: [code=C++] #include <algorithm> #include <fstream> #include <iostream> #include <iterator> #include <string> using namespace std; int main() { string filename; cout << "Enter the numbers filename> "; getline( cin, filename ); ifstream file( filename.c_str() ); if (!file) { cout << "Invalid filename.\n"; return …

Member Avatar for Duoas
0
270
Member Avatar for lahom

You will have to keep track of whether or not the user has supplied a filename yet. If not, display the save dialog. If he has, then don't bother displaying the dialog and just save the file. Essentially, your OnClick handler for the button should work like this: [code] if …

Member Avatar for Duoas
0
71
Member Avatar for johnkurtz
Member Avatar for luis_ramos
0
180
Member Avatar for Anita Jennifer

Hi! The following is also a very illuminating document. [URL="http://david.tribble.com/text/cdiffs.htm"]Incompatibilities Between ISO C and ISO C++[/URL]

Member Avatar for Anita Jennifer
0
100
Member Avatar for jrkeller27

You know that you can [b]getline[/b]() with any character as delimiter, so why not use that to test for a potential separator sequence? [code=C++] #include <iostream> #include <string> #include <vector> using namespace std; vector<string> read_lines( istream&ins, const string& separator ) { vector<string> lines; string line; char head = separator[ 0 …

Member Avatar for William Hemsworth
0
1K
Member Avatar for wellibedamned

You need to be working with floats on the right-hand side to get floating-point division. Right now you are doing integer divisions. [inlinecode]s -= 1.0/(i*i);[/inlinecode] This one gets everyone at least once a year. Hope this helps.

Member Avatar for wellibedamned
0
113
Member Avatar for cobaltbass

Or rather: [code=C++] #include <limits> ... int main() { ... cout << "Press Enter to continue..."; cin.ignore( numeric_limits<streamsize>::max(), '\n' ); return 0; } [/code]

Member Avatar for Duoas
0
283
Member Avatar for toolbox03

[code=C++] template<typename T, typename U> void print_first_five( map<T,U> m ) { for (int i = 0; i < (m.size() >= 5) ? 5 : m.size(); i++) cout << m[i].second; } [/code] Hope this helps.

Member Avatar for Duoas
0
110
Member Avatar for petzoldt01
Member Avatar for petzoldt01
0
358
Member Avatar for daviddoria

It is because you are trying to pass a temporary object to the function. Temps are const. Therefore your function header should be: [inlinecode]void CreateCostGrid(const vector<ScanPoint> &Data, int whichcol, vector<LiDARScan> &LiDARGrid);[/inlinecode] If you want to modify the data, then your [b]getColumn[/b]() function must return a non-const reference. [inlinecode]vector<ScanPoint>& getColumn(...);[/inlinecode] Hope …

Member Avatar for Duoas
0
110
Member Avatar for vikram_sriram16

Google "msdn FindFirstFile", FindNextFile, FindClose. For the path, just put the floppy's drive letter first, like "A:\*".

Member Avatar for jephthah
0
287
Member Avatar for Run.[it]

You are screwing-up your [b]gcount[/b]() by using [b]ignore[/b](). Get the count first, then ignore. Hope this helps.

Member Avatar for Run.[it]
0
182
Member Avatar for Diode

Get rid of that [inlinecode]-c[/inlinecode] and try again. Linux only executes ELFs, not OBJs.

Member Avatar for jephthah
0
9K
Member Avatar for devaradhan

Please tell us: [list=1] [*]Exactly what OS you are programming for [*]Exactly what GUI package you are progamming for [*]Might as well tell use your compiler, too [/list]

Member Avatar for Duoas
0
73
Member Avatar for toolbox03

Or you could read one line at a time (or even the whole file) and use standard algorithms to remove digits: [code=C++] #include <algorithm> // remove_if() #include <cctype> // isdigit() #include <functional> // ptr_fun<> #include <string> ... string remove_digits( const string& s ) { string result( s ); result.erase( remove_if( …

Member Avatar for Duoas
0
92
Member Avatar for DinoSauro

Are you using a global or local hook? If global, it is possible that IE installs a global hook on "https://" pages that blocks the rest of the hook chain. The only way around that would be to install your hook after IE opens the https page, and I don't …

Member Avatar for michaelHuo
0
109
Member Avatar for kllera

That won't help to reduce/simplify fractions so much as using the Greatest Common Divisor. Here it is with the Euclidean algorithm, unrolled one iteration. [code=C++] int GCD( int a, int b ) { while (true) { a = a % b; if (a == 0) return b; b = b …

Member Avatar for Duoas
0
137
Member Avatar for Crushyerbones

[i]Display[/i] and UI are linked. Sorting (an underlying algorithm) is not. The best CUIs provide maximum data display and minimum query display. For example, your program may run something like this (bold represents user input): [code] % [b]a.out[/b] Crush Yer Bones's College Project Mr. Teacher Algorithms, Spring 2008 Enter 'help' …

Member Avatar for Salem
0
111
Member Avatar for VernonDozier

You should have gotten a runtime exception for trying it... Anyway, Windows apps don't have consoles by default. At the beginning of your program you'll have to [inlinecode]AllocConsole();[/inlinecode] then... you'll have to hook the standard streams up to the console: [url]http://www.halcyon.com/~ast/dload/guicon.htm[/url] (yoinks!) Its easier than it looks. Have fun.

Member Avatar for VernonDozier
0
703
Member Avatar for kux

You might also benefit from reading through [URL="http://www.newty.de/fpt/index.html"]the Function Pointer Tutorials[/URL].

Member Avatar for Duoas
0
89
Member Avatar for Onixtender

Don't do this: [inlinecode]char recordd[sizeof(record)] [COLOR="Red"][b]= {0}[/b][/COLOR];[/inlinecode] It isn't doing what you think it is. As another hint, you should compile using the [b]-Wall[/b] option. I did and it told me, right off the bat without having to look at your code: [list] [*]You are missing a header (since the …

Member Avatar for Onixtender
0
141

The End.