6,741 Posted Topics

Member Avatar for failbot

CountDown::end() doesn't return anything yet you declared it to return bool. That makes you a liar. ;)

Member Avatar for predator78
0
165
Member Avatar for Red Dragon

[B]>else DIR * mydir = opendir(dir);[/B] Note the [ICODE]else[/ICODE] without braces. This means you have an else clause with one statement that defines a variable and then immediately destroys it. It's as if you had braces like so: [code] else { DIR * mydir = opendir(dir); } [/code] [ICODE]mydir[/ICODE] doesn't …

Member Avatar for Red Dragon
0
360
Member Avatar for stereomatching

[QUOTE]The codes generated by template are same as handcrafted codes, so what makes template being blamed by code bloat if you know how to handle it properly?[/QUOTE] Nothing, [U]if[/U] you handle it properly. Most of the time there's a lack of understanding about how templates work, ignorance of the solutions …

Member Avatar for pseudorandom21
0
176
Member Avatar for The Dude

There's a link at the bottom of every page (under the About Us, Contact Us, etc.. links) that will take you back to the forum index.

Member Avatar for The Dude
0
105
Member Avatar for Derek Elensar

[B]>if(letter_counter == '\n') //|39|error: ISO C++ forbids comparison between pointer and integer|[/B] [ICODE]letter_counter[/ICODE] is an array of char, but '\n' is a single char. When arrays are used in value context they're converted to a pointer to the first element, so your comparison types are [ICODE]char*[/ICODE] and [ICODE]char[/ICODE], which are …

Member Avatar for Derek Elensar
0
1K
Member Avatar for gynmd
Member Avatar for gynmd
0
173
Member Avatar for gcardonav

There's no sorting going on in your code. Any ordering is coming from the files themselves.

Member Avatar for Sky Diploma
0
268
Member Avatar for VernonDozier

[B]>stream.seekg(7, ios_base::beg);[/B] seekg() is for adjusting the read pointer. You want seekp() to adjust the write pointer.

Member Avatar for Sky Diploma
1
233
Member Avatar for lexusdominus

&& has higher precedence than ||, so the evaluation looks like this: [code] if ( (initialize == "off" && Iminor > 20) || Imedium > 10 || Isevere > 5 || Ifatal > 0 ) [/code] When what you really want is this: [code] if ( initialize == "off" && …

Member Avatar for lexusdominus
0
130
Member Avatar for anaychowdhary

We don't give away code so that students can cheat on their homework. If you want to put forth some effort in writing this program you'll find help here, otherwise the thread will be in violation of Daniweb's rules and be either closed or deleted.

Member Avatar for anaychowdhary
-2
182
Member Avatar for Dani
Member Avatar for The Dude
0
233
Member Avatar for centerline00

Does the string need to represent a valid value for a specific integer type? Or are you just looking for digit characters and possibly a sign?

Member Avatar for centerline00
0
263
Member Avatar for programing

Use a second stack. Pop each item off of the first stack, push them onto the second stack, then pop items off the second stack and print them until it's empty.

Member Avatar for Narue
0
155
Member Avatar for lexusdominus

There has to be some conversion. The two operands need to be converted to an integer type, and then the result of addition needs to be converted to a string. For example using boost::lexical_cast for brevity: [code] string string3 = boost::lexical_cast<string>( boost::lexical_cast<int>(string1) + boost::lexical_cast<int>(string2)); [/code] boost::lexical_cast is basically just a …

Member Avatar for lexusdominus
0
121
Member Avatar for Jimmyteoh

[QUOTE=cmccaig;1561153]he may of meant char answer= ''Y''N''; ^ something like that so that when its printed to console its separated by '[/QUOTE] And what [U]character[/U] would that represent?

Member Avatar for Narue
-1
929
Member Avatar for sadsdw

It looks to me like you should be tokenizing the string into fields first, then using a specific field as the comparison data. std::sort() takes a third argument as a predicate, if you want to customize the comparison method: [code] #include <algorithm> #include <fstream> #include <iostream> #include <string> #include <vector> …

Member Avatar for sadsdw
0
2K
Member Avatar for peponas

Unless the lines have a fixed column width, you have little choice but to read and discard lines until reaching a certain count: [code] #include <stdio.h> /* Get the nth line (1-based) from the current read position */ int get_nth_line(FILE *in, char *buf, size_t size, size_t n) { size_t i …

Member Avatar for peponas
0
147
Member Avatar for shyla

[QUOTE]no in a console in visual studio 2010[/QUOTE] That's a Windows environment, unless Visual Studio was made portable across platforms without my knowledge. :icon_rolleyes:

Member Avatar for Narue
0
969
Member Avatar for MooCrow

You have the right idea already, just extend it for all characters instead of just the alphabet. Then you can either process the frequency array later to get the count of non-alphabetical characters, or keep a running count if you wish: [code] #include <ctype.h> #include <limits.h> #include <stdio.h> int main(void) …

Member Avatar for Narue
0
153
Member Avatar for tubby123
Member Avatar for Arbus
0
193
Member Avatar for thekashyap

[QUOTE]All identifiers starting with one or two underscore characters are reserved for the compiler vendors for use in their implementation (of either the standard libraries or language extensions, or both).[/QUOTE] Just a minor nit, since I feel the need to defend my own naming convention. ;) What you've said is …

Member Avatar for thekashyap
3
579
Member Avatar for Real Engineer

[QUOTE]no body seems to help[/QUOTE] Your idea of help doesn't correspond to ours. "Help" does not mean "write it for me".

Member Avatar for mohamads
-1
261
Member Avatar for predator78

Look at your "overloaded" constructor. Does it allocate memory? Does it dereference the pointer as if memory were allocated?

Member Avatar for predator78
0
92
Member Avatar for NoUserNameHere

[QUOTE]What tutorial would you recommend?[/QUOTE] I recommend [URL="http://eternallyconfuzzled.com/tuts/datastructures/jsw_tut_linklist.aspx"]this one[/URL]. The code is in C, but mostly relevant to C++. Pretty much the only thing that needs to be changed to compile as C++ is adding a cast to malloc calls.

Member Avatar for Narue
0
112
Member Avatar for Labdabeta

[URL="http://msdn.microsoft.com/en-us/library/ms680582%28VS.85%29.aspx"]Clicky[/URL].

Member Avatar for Labdabeta
0
470
Member Avatar for UltimateKnight
Member Avatar for eman 22
Member Avatar for Roelof Wobben

You're neglecting to account for the subtraction of '0' (with an integer value of 48, in this case): c = 49 0 * 10 == 0 0 + 49 == 49 49 - 48 == 1 Next character: c = 50 1 * 10 == 10 10 + 50 == …

Member Avatar for jl.lakhnai
0
223
Member Avatar for chintan_1671

The overload of m_pParent->Log() you're calling isn't defined anywhere that the compiler can see. To start, make sure it has a definition for the type and number of arguments you're passing.

Member Avatar for Narue
0
293
Member Avatar for ssaleem1992

Did you search the forum? Did you search google? I bet you didn't, because such an example is trivial to find. People are generally less friendly when they have to answer the same question for the umpteenth time because you're too lazy to put in a little effort in helping …

Member Avatar for Narue
0
33
Member Avatar for miguelsan

[QUOTE]When I use the length() function it only counts the characters from the first word.[/QUOTE] The problem isn't getting the string length, that's correct. The problem is that the way you're getting input stops at the first whitespace. So when you type "hello world", the string only contains "hello" and …

Member Avatar for Narue
0
167
Member Avatar for kimkim0513

[QUOTE]b)assign a newly created dynamic array of 99999 pointers of X to w. [CODE]w=new &&X[99999];[/CODE][/QUOTE] Erm, close. Let's start with s first: [code] s = new X[99999]; [/code] The difference between s and w is one level of indirection, so the new[] expression should reflect that in the type: [code] …

Member Avatar for Narue
0
150
Member Avatar for something_techy

[QUOTE]Huh? I thought endianness is HW-dependent, not OS-dependent.[/QUOTE] That's true at the OS vs. CPU level, but it's more of a practicality than a requirement. While the processor runs in a specific endian mode (some can even switch between modes), endianness at any higher level is really about performance and …

Member Avatar for Narue
0
304
Member Avatar for Derek Elensar

Type a string, then hit enter, then type a space and hit enter again. That'll get you through the maze of ignores. ;) What exactly are you trying to accomplish here?

Member Avatar for Derek Elensar
0
205
Member Avatar for Dean_Grobler

[QUOTE]Should I rather work out late at night before bed, or early in the morning right after I wake up?[/QUOTE] Work out at the time that is most convenient for your schedule. I go to the gym after work for about an hour because that's the most convenient time. [QUOTE]you …

Member Avatar for Lardmeister
0
203
Member Avatar for Billy D

[code] string cmd("mkdir \"/Users/" + user + "/Library/Application Support\""); system(cmd.c_str()); [/code]

Member Avatar for Billy D
0
362
Member Avatar for asilter

Thanks for the post, IcantC, but take note that this thread is four years old. Perhaps your expertise would be better spent on current threads? :)

Member Avatar for IcantC
1
180
Member Avatar for rEhSi_123

[QUOTE]Now from what I have heard bubblesort are not efficient for large sets of data, is it true?[/QUOTE] For the most part, yes. For the quadratic sorts, insertion sort is a better choice, though [URL="http://www.cplusplus.com/reference/clibrary/cstdlib/qsort/"]qsort from <stdlib.h>[/URL] should be the first algorithm you turn to since it's highly likely to …

Member Avatar for Narue
0
104
Member Avatar for missscareall

You can do this with two variables: one for the first value in a matching sequence and one for the current value. As long as they match, increment your counter. When they don't match, print your result for the sequence, reset the counter to zero, and set and the first …

Member Avatar for Saith
0
153
Member Avatar for Rickay

Run it as a background process: [code] $ ./myprog & [/code] I'm not 100% with OS X, but in theory this should work since Darwin is based on Unix.

Member Avatar for Rickay
0
274
Member Avatar for custurd122000

Shall we start with MyQueue::pop_front() being completely nonsensical? You always return queue[100], and 100 isn't even a valid index in the array.

Member Avatar for custurd122000
0
166
Member Avatar for peq

Excepting leap years, a month could have 28, 30, or 31 days. Your Date object contains the month, so you can use that to determine how many days there are in the preceding months quite easily using either a switch or table lookup. For example, you want to know how …

Member Avatar for Narue
0
92
Member Avatar for Rickay

[QUOTE]when I updated to Xcode 4 I have problems[/QUOTE] You and everyone else. Did you hear that Apple's bug reporting server crashed after they released Xcode 4 due to the load?

Member Avatar for Rickay
0
6K
Member Avatar for dvidunis

[QUOTE]3: Are you posting in the most appropriate place to receive relevant replies? This is the C++ Forum. YES[/QUOTE] This doesn't strike me as a C++ question in the slightest, actually.

Member Avatar for Narue
0
275
Member Avatar for centerline00

I'm going by your comment rather than the vague "it's failing out": [B]>perc[i] = (votes[i] / sum) * 100;[/B] So votes[i] and sum are both integers. Keeping in mind that any precision will be truncated, you probably wanted this instead: [code] perc[i] = (votes[i] / (double)sum) * 100; [/code] By …

Member Avatar for centerline00
0
89
Member Avatar for x38class

So you're receiving emails with an account you don't have? ;) Assuming the emails are going to the current account in your control panel (otherwise you wouldn't be getting them) and the "wrong" email is informational, it's probably the email address you registered with in the first place in 2004.

Member Avatar for Dani
0
240
Member Avatar for goocreations

Is there any reason why you can't use double instead of int in the first place? That way the conversion would be unnecessary.

Member Avatar for mrnutty
0
5K
Member Avatar for jimmymack

[QUOTE]is itsVal in the Add function VarOne and the initialized (2) from the Counter::Counter(int initialValue): itsVal(initialValue) {}constructor?[/QUOTE] Yes. [QUOTE]and is it added to a const Counter reference of VarTwo?[/QUOTE] No, VarOne::itsVal is added to VarTwo::itsVal, and that result is used to initialize a Counter variable for return from the Add …

Member Avatar for jimmymack
0
142
Member Avatar for tubby123

[QUOTE]Now when i look at it, i feel everything can be done using a 1-d array and incrementing the pointer appropriately.[/QUOTE] Just because you [i]can[/i] do something doesn't mean it's always the best way.

Member Avatar for rockerjhr
0
152
Member Avatar for Ahmed sunny

[QUOTE]i dont know about command line arguments in OOP[/QUOTE] There's nothing OOP about it. main() takes two parameters: an integer containing the count of arguments, and an array of pointers to char containing the string value of each argument: [code] #include <iostream> using namespace std; int main(int argc, char *argv[]) …

Member Avatar for Arbus
0
961

The End.