364 Posted Topics

Member Avatar for Griff0527

Your problem is at line 31. Which order should number and beforeSum be, in order to perform the subtraction? Also, you have a problem with a number like "XIV", since when you determine you have "I" before "V", you throw out the previous sum -- which was probably "XI", so …

Member Avatar for raptr_dflo
0
377
Member Avatar for pendo826

Why do you have [ICODE]grow_size[/ICODE] and [ICODE]num_elements[/ICODE] members in your array-class, when you don't use them anywhere? Your code mostly looks fine, just give some thought to what [ICODE]size[/ICODE] means and whether you can trust it. Also, what does your [ICODE]Insert()[/ICODE] method do if the array is already full?

Member Avatar for raptr_dflo
0
188
Member Avatar for Labdabeta

The discrepancy might be caused by any number of factors. If your graphics card doesn't support VBOs (vertex-buffer objects), then your code is creating them but the OpenGL library is, in software, converting them to something the card -does- support and sending that. If you have a huge number of …

Member Avatar for raptr_dflo
0
331
Member Avatar for Joker500

Works fine for me. Try printing the accountType immediately after you input it, to verify you got it. Also, about 5 lines up from where you currently start your output, you have a typo which assigns 'C' to accountType instead of testing whether it's equal to 'C'. In the future, …

Member Avatar for WaltP
0
523
Member Avatar for newbie1234

Did you scroll down far enough to find the link to [URL="http://www.cryptopp.com/wiki/Main_Page"]this[/URL]? Somewhere in there is probably some help as far as how to use the library....

Member Avatar for raptr_dflo
0
252
Member Avatar for shankhs

Hey crisple, Welcome to DaniWeb, but please don't post new questions into long-dead (and solved) threads. This thread was solved back in 2008, and the more recent also-inappropriate additions were from over a year ago. Please start a new thread instead. As the notice immediately below my response instructs.

Member Avatar for venugopal.somu
0
504
Member Avatar for cutterpillow20

Your program (for value 5) appears to draw lines up to 5 characters in length, and then back down. The correct output would be a TOTAL of 5 lines. What is the maximum length of a line in this case? What do you think the program should display if you …

Member Avatar for grh1107
0
820
Member Avatar for hmartinez

Commenting out the line where the compiler is complaining, internal to a huge header that works fine in another project, is not the correct approach. Instead try commenting out items preceding the #include for this library -- other #includes before this one? I suspect that a different header is declaring …

Member Avatar for hmartinez
0
502
Member Avatar for stamatt45

Actually, I think the problem is that n is too large (since you determine the number of base-10 digits you need to represent the integer, by repeatedly dividing by 10, rather than the smaller number of hex digits you need). You then fill most of the array r, correctly dividing …

Member Avatar for raptr_dflo
0
3K
Member Avatar for doboi

Your deleteMatrix() function frees the nodes from each row, but not the rows or the matrix-structure itself. Make sure that everything you malloc() (or [ICODE]new[/ICODE]), you also later free() (or [ICODE]delete[/ICODE]). Simplify, simplify, simplify. Your buildRandomMatrix() function calls createMatrix(rows, cols); if the latter allocates the [ICODE]cols[/ICODE] elements of each row …

Member Avatar for MastAvalons
1
198
Member Avatar for Labdabeta

I've never been thrilled with the idea of complex data types as return values of functions. That may well just be personal preference, but I would either dynamically allocate an instance of the MoveScore structure, return the pointer to it, and free the allocated instance when done; or pass a …

Member Avatar for Labdabeta
0
313
Member Avatar for Rdel

Any header file ([ICODE]foo.h[/ICODE]) provides the declarations/prototypes for variables, functions, and classes (and because of how they're handled by the compiler, implementation of templated objects, but that's another story). I have no idea what specifically might be declared/prototyped in [ICODE]cpu.h[/ICODE]. Or [ICODE]cpuh.h[/ICODE], since that's what you're including, twice. But now …

Member Avatar for Dexxta27
-1
1K
Member Avatar for Hajira Khanum

You're resetting your row1, ... counters to zero inside your play-loop. Your code may be easier to follow if instead of trying to maintain the state of each row/column/diagonal each time the user strikes out a number, you just manually do the check. It will be marginally slower, but at …

Member Avatar for Hajira Khanum
0
174
Member Avatar for TheFearful

I'm not going to take the time to download and read your Word-format document, since you didn't take the time to copy&paste the most minimal portion of it into your post. That said, your logic is flawed in your inputVLI routine: you're inputting a "digit" and storing its integer value …

Member Avatar for raptr_dflo
0
115
Member Avatar for thecoolman5

The [i]variable[/i] isn't in scientific notation, it simply stores the value (the specifics of how it does so are irrelevant to your question). The issue of notation is how the value of that variable is [i]displayed[/i]. It sounds like your problem is actually "how do I parse a number in …

Member Avatar for raptr_dflo
0
246
Member Avatar for iamuser_2007

Looks like you copied the table of contents from, e.g., [URL="http://cpp.datastructures.net/textbook/index.html"]here[/URL]. The concept of a "locator" is given only maybe 8 pages of attention in that edition, according to the page-numbers given, ~4 of discussion and ~4 of implementation. Of course the content isn't available online, the publisher expects you …

Member Avatar for raptr_dflo
0
147
Member Avatar for black22622

Modular programming is good too. Rather than just a nearly-600-line start() method, and a 150-line main(). Break it up into meaningful chunks. It will be much easier to for others to follow, and more importantly, easier for you to maintain/improve later.

Member Avatar for raptr_dflo
0
4K
Member Avatar for babyhuyx

At line 100, you return a score without first undoing the move. So instead, try something like: [CODE] int score = -1; if (b.hasWon(player)) score = 100; b.undoMove(col); if (score >= 0) return score; [/CODE] or just: [CODE] if (b.hasWon(player)) { b.undoMove(move); return 100; } else b.undoMove(move); [/CODE] Then above, …

Member Avatar for raptr_dflo
0
136
Member Avatar for nijinjose123

Another way to say what Narue said is: programming is an exercise in precision. It's nearly impossible to program something until you can think about it (and thus speak about it) precisely. And once you can think about the problem precisely, the code virtually writes itself. Learning to program is, …

Member Avatar for raptr_dflo
0
1K
Member Avatar for Topherman

At line 13, you're also initializing [ICODE]min[/ICODE] to the first (zero'th) element of the array before you've initialized the array. Instead, do the same thing, but immediately before the loop over the elements of the array where you're updating [ICODE]min[/ICODE] (lines 29-34 above).

Member Avatar for raptr_dflo
0
1K
Member Avatar for GeekZu

[ICODE]argv[0][/ICODE] passed into your main is the path to the executable. It might be a fully-qualified path, or it might be relative to the directory the user was in when he/she started the program. If the latter, there should be a function call out to the OS to return the …

Member Avatar for eddiecrosby
0
936
Member Avatar for thecoolman5

I think he was at least partly busting your chops. There have been at least two other threads on the exact same subject in the past few days, are you guys all in the same class? Try this one: [url]http://www.daniweb.com/software-development/cpp/threads/365271[/url]

Member Avatar for eddiecrosby
0
4K
Member Avatar for Dman01

OK, I'm going to start from the beginning. Assume I know nothing. I understand that you want to manipulate really big numbers. What values are you storing into your [ICODE]m_DATA[/ICODE] array of unsigned ints? Single decimal digits [0-9]? Or arbitrary unsigned 32-bit values? Either way, your assignment to [ICODE]unsigned int …

Member Avatar for Dman01
0
685
Member Avatar for jonspeidel

Everything is possible. Reagrdless of how quick-and-dirty you're trying to be, take good advice when it's given. main should almost always be declared as: [CODE] int main (int argc, char *argv[]) { ... } [/CODE] And there's almost never a reason to call it from inside itself or any other …

Member Avatar for WaltP
0
253
Member Avatar for nuclear

No values in your code are "changing permanently". When a key is pressed, an event is triggered, you catch the event, and you assign a value to your message variable. As soon as you blit your message, you set your message variable back to 0. That doesn't look permanent to …

Member Avatar for raptr_dflo
0
489
Member Avatar for SureshAbraham

I've been doing "desktop application" programming almost forever, it feels like. For the past couple years, using the Qt framework ([url]http://qt.nokia.com/[/url], not Apple's QuickTime library). It may be a bit hard to come up to speed on initially, but it nicely handles more complex aspects of GUI design, including managing …

Member Avatar for Dakot
0
289
Member Avatar for AbEeR Q8

So which functions do you need to write? They all look "written" to me.... Accessing the system clock may be dependent on what operating system you're running on (Windows, Linux, other), and what APIs you have available. If you're running in Windows, try searching [url]http://msdn.microsoft.com/[/url] . It's often hard to …

Member Avatar for raptr_dflo
0
124
Member Avatar for subith86

Also, 30.000 can be represented exactly as a float, so I'm concerned that your calcualateAvailableUnits() function may be doing something which unnecessarily introduces error into your value. While fractions of units may be necessary in your computation, it may be worthwhile to consider if there's an intelligent way to keep …

Member Avatar for Tumlee
0
204
Member Avatar for pingpongplaya

I would add that there's no point implementing operator+() until you're sure you can correctly input and output polynomials. I suspect something's going to need to change in how you define your Poly class.... (Hint: in your non-default constructor, how big is the array coeff[]?)

Member Avatar for pingpongplaya
0
4K
Member Avatar for Kyle Willett

[QUOTE=frogboy77;1696315][CODE]#include <iostream> #include <string> using namespace std; bool is_pal(string a) { int b=a.length(); for(int i=0;i<(b/2);++i) if(a[i]!=a[b-i-1])return false; return true; } int main() { string s; cout<<"Please enter a string:\n"; cin>>s; if(is_pal(s)) cout<<"This is a palindrome.\n"; else cout<<"This is not a palindrome.\n"; return 0; }[/CODE][/QUOTE] frogboy, please don't post complete solutions …

Member Avatar for frogboy77
0
267
Member Avatar for efigen

Please post the definition of your RecordArray variable. So far I can't tell why if the string found in one place (or its integer conversion) is greater than another, why you're swapping the last items between the two places. Let's start with: What data are you storing? What does it …

Member Avatar for efigen
0
512
Member Avatar for GhostMonkey

And you still can't store 2D coordinates of the form (x,y) into a list<int>. Perhaps you need a structure like: [CODE] struct PointWithDistanceFromKnownPoint { int x; int y; int manhattanDist; }; [/CODE] And then form a list of those, and provide a "comparator" to the list.sort() function. If we're all …

Member Avatar for raptr_dflo
0
108
Member Avatar for pnoylover

What error message do you get? We can't see your screen from here.... Also, why do you call add() twice from your input case (once after inputting num, and again after inputting age)? Why do you declare your "node" to contain two integers and two strings, but provide two separate …

Member Avatar for raptr_dflo
0
202
Member Avatar for phorce

Well [ICODE]max(numbers[m], numbers[m])[/ICODE] presumably returns the maximum of the same value provided twice. Which is obviously a silly thing to ask for. My recommendation: stop trying to do it "the cool way" and actually think about what you're trying to accomplish, and how to go about accomplishing it one step …

Member Avatar for raptr_dflo
0
139
Member Avatar for Rokie

The problem is at the first line in your main: [ICODE]MyExaminerViewer a = new MyExaminerViewer();[/ICODE] The [ICODE]new[/ICODE] keyword dynamically allocates an instance of the specified class and returns a pointer to it. The correct usage of the default constructor is either [ICODE]MyExaminerViewer a; // shorthand for MyExaminerViewer a();[/ICODE] or [ICODE]MyExaminerViewer …

Member Avatar for raptr_dflo
0
382
Member Avatar for MrEARTHSHAcKER

Regardless of which compiler you're using, how are you declaring your class, and how do you expect to use it? Anything you wish to access from outside the class implementation should be declared [ICODE]public:[/ICODE] ... by default, the contents of a C++ class are [ICODE]private:[/ICODE]. There's also a [ICODE]protected:[/ICODE] declaration …

Member Avatar for MrEARTHSHAcKER
0
3K
Member Avatar for existence19

[QUOTE=chary8088;1693890]stl has not hash map as I know, you can search some open source ,there are many excellent open source library for hash map[/QUOTE] [URL="http://www.cplusplus.com/reference/stl/map/"]stl::map<>[/URL] I think does pretty much exactly what anyone would need, with the exception of providing your own hashing function. There's a multimap<> container as well, …

Member Avatar for vijayan121
0
823
Member Avatar for alexander1s

Sigh. Why, oh why, do people not read the very-clearly-marked "Read This Before Posting A Question" [URL="http://www.daniweb.com/software-development/cpp/threads/78223"]sticky-thread[/URL] at the top of the Forum? Hi alexander1s, welcome to DaniWeb, and sorry to be such a grump, but this is probably the fifth post I've read in the past 15 minutes that …

Member Avatar for VernonDozier
0
140
Member Avatar for essentialc++33

Welcome beginner, [QUOTE]There might be some errors.[/QUOTE] Might? Did you run your own program and see what it outputs? (Hint: there are several errors in your get_pie() function involving data types.) Also, please use [ CODE ] tags (select your code after you paste it, and click the [ CODE …

Member Avatar for raptr_dflo
1
4K
Member Avatar for shouvik

Yes, but the question is "can -you- convert it to C?" ;) Please don't post into old threads. The corrected code was posted well over a year ago. Instead, start a new thread, including your specific questions and your own code. You can provide a link to the old thread …

Member Avatar for raptr_dflo
0
554
Member Avatar for az.rathore

If you haven't learned stacks yet, then you should (probably) ignore the advice. Instead, just think through the problem in very small pieces: 1) Start with your input value. Is that part of the "bumpy" sequence? If so, count it. 2) Is your sequence finished? If so, you should already …

Member Avatar for raptr_dflo
0
212
Member Avatar for vishwanath.m

[QUOTE=chary8088;1693878]vector is a template array, you can insert a element into any where you want; like this [CODE] vector<string>vData; vData[5] = "adfa"; [/CODE][/QUOTE] Techincally, that's "replacing an element." Inserting implies moving other values out of the way. Specifically in an array or std::vector<> situation, that involves moving each element, from …

Member Avatar for raptr_dflo
0
177
Member Avatar for sita12345

Among other things, you may have NULL pointers in your vector, which can't be [ICODE]delete[/ICODE]d. Verify what's in your vector before you worry about what's wrong with your deletion code, e.g.: [CODE] // changed to while() loop to make logic more obvious vector<T*>::iterator iter = x.begin(); while (iter != x.end()) …

Member Avatar for sita12345
0
367
Member Avatar for astrolegacy
Member Avatar for astrolegacy
0
153
Member Avatar for FiToKa

It looks pretty good the way it is. What problems are you having with it?

Member Avatar for FiToKa
0
147
Member Avatar for sohair

Sounds like an interesting project. Have you written code that communicates over a serial-port before? It's been so long since I've done so (more than 10 years ago) that I wouldn't be much help. I suspect a Google search would get you well underway.

Member Avatar for raptr_dflo
0
355
Member Avatar for coolbeanbob

Did you make your implementation match the method-declaration in the class? We don't need 1,000 lines of code, the original error message told you exactly what the problem was: you originally declared your insert() method to take type [ICODE]Entry &[/ICODE] which allows the argument to be altered within the method, …

Member Avatar for raptr_dflo
0
493
Member Avatar for kodemaaster

Since I don't see anything obvious wrong with your function itself, how are you allocating the Request* that you're passing into the function?

Member Avatar for raptr_dflo
0
2K
Member Avatar for thenewbiecoder

Close. (And in the future, please use [ CODE ] tags around your code -- select a code segment and click the button/icon at the top of the editor.) In part 3, remember which class you're providing the implementation for. Then, how are the studentName and studentScore going to get …

Member Avatar for raptr_dflo
0
211
Member Avatar for deeps2_daniweb

Why do you expect: [CODE] fil1.write((char*)&e1,sizeof(e1)); [/CODE] to write a human-readable line like your sample indicates? That's one (non-portable) way to write a terse binary record. Instead, for text files, keep it simple: [CODE] fil1 << e.name << " " << e.num << " " << e.dep << " " …

Member Avatar for raptr_dflo
0
2K

The End.