6,741 Posted Topics

Member Avatar for murschech

divides is a standard function object defined in <functional>, and Dev-C++ is better at not letting you do stupid things than the [B]older[/B] Borland C++ 5.5 (which is what I assume you're using).

Member Avatar for jwenting
0
105
Member Avatar for Acidburn

>char a = 'abcde' would be legal right? If the implementation allows a character literal like that then it's perfectly legal. However, the result is not the same as an array consisting of the characters 'a','b','c', and 'd' in any case. >Or can a single char only hold 1 char? …

Member Avatar for Narue
0
128
Member Avatar for Acidburn

How about you explain what you're trying to do? My first impression is that your code is broken due to several misconceptions about how strings work. >for (int j = 0 ; j <=sizeof(RW[j]); j++) sizeof RW[j] is 1. Always. >for (int i = 0 ; i <=sizeof(array[i]); i++) sizeof …

Member Avatar for dwks
0
91
Member Avatar for rasheed1982

>I Have One Doubt. No, you have a question. A doubt is not a question. A doubt is skepticism, you know the answer but still don't believe it or know just enough of the answer to be uncertain of its truth. A question is an inquiry for the purpose of …

Member Avatar for rasheed1982
0
99
Member Avatar for bobpierce01

>I asked some of our friends in the C/C++ Forum at DaniWeb Who gave you the answer you asked for but not the answer you were looking for. C's nesting limit has nothing to do with Python's nesting limit. But the cold hard fact of the matter is that Python …

Member Avatar for alc6379
0
390
Member Avatar for ganeshpujar

There are no certifications that matter. If you want to be "certified", make a name for yourself by helping with high profile projects and doing a good job.

Member Avatar for Narue
0
50
Member Avatar for Subterraneus

>all the information on System() is just confusing to me It's just a command interpreter. Pass it a string just like you would your shell and things will happen. :rolleyes: Intuitively, system is one of the simplest functions.

Member Avatar for Subterraneus
0
154
Member Avatar for ani_manit

>Hi I am in III yr engg. >Any1 wid any Please try to use proper spelling and grammar. Not everyone who reads these forums is a native English speaker and those people will find your silly abbreviations impossible to decipher. >programming experience on steganography and/or Virtual Private Networking, please help. …

Member Avatar for Narue
0
173
Member Avatar for K_te_J

%ld is a long integer. You can add a field width that specifies the minimum number of characters to print. So %5ld will pad numbers with fewer than five digits using spaces. You can add a precision using a period and another number that specifies the minimum number of digits …

Member Avatar for Narue
0
448
Member Avatar for btech

Quadratic probing uses a quadratically growing increment that's added to the address. So if you have address 30, you would start with an increment of 1. If 31 is occupied, you square the increment to 2 and try address 33. If 33 is occupied, you square the increment to 4 …

Member Avatar for Narue
0
116
Member Avatar for WittyFool

>What's the difference between the two? The difference is how you access the object, how long the object lives, and where it's stored.

Member Avatar for kon_t
0
139
Member Avatar for mydadisadentist

>Is there any way to resize a console program while its running [url=http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/setconsoledisplaymode.asp]Perhaps[/url]. >also whats a better way to clear the console then The best way to clear the console is to not clear the console. But if you must, there really isn't a good way, so pick whichever you …

Member Avatar for mydadisadentist
0
702
Member Avatar for l-o-s-t

>I tried using blah ( tree -> rightp ) Why? tree->rightp is a node*, but the function expects a node** because you typedef'd Treep to be a node*, and blah asks for a Treep*. The progression is like this: Treep becomes struct node* so Treep* becomes struct node** So you …

Member Avatar for l-o-s-t
0
259
Member Avatar for Libbie

>I was wondering which lang is best for game designing. It depends on what kind of games. You'll get the most mileage out of C and C++, but Java, Python, and assembly might play important roles as well.

Member Avatar for Narue
0
64
Member Avatar for monique83

>Create three float arrays A, B and C with 500000000 elements Assuming that float is four bytes, you're looking at 6 gigs worth of storage. Your timing will be way off because of thrashing. A better solution would be to do a fraction of this and then multiply it into …

Member Avatar for monique83
0
131
Member Avatar for YoTaMiX

user_r.r and user_r.l are Point objects. The < operator isn't defined for them. You need to change your comparison to use user_r.r.x and user_r.r.y and likewise for user_r.l.

Member Avatar for Narue
0
110
Member Avatar for wigster84

You need to convert the tokens to integer values before you can do an easy range check on them: [code] #include <stdio.h> #include <stdlib.h> #include <string.h> #define RANGE 50 int main ( void ) { char string[] = "6565,4325,7074,7897,7685,3478"; const char *seps = " ,"; char *token; int target; printf …

Member Avatar for Narue
0
335
Member Avatar for Geek-Master

>will anything that is passed to whatever be assigned to x_ using the initializing list? Assuming whatever is a compatible initializer for x_, yes.

Member Avatar for WolfPack
0
3K
Member Avatar for moznmar

It sounds like you have a building issue rather than a code issue. It links and runs just fine for me on Visual Studio .NET 2003. Try making a new project and pasting your code into it, then let us know if it worked or not.

Member Avatar for moznmar
0
152
Member Avatar for caseg

This works, with only minor changes to your original code. Remember that things you do once are outside of the loop, the sum has to start at 0 to give you any useful information, and the basic idea is to add num to sum until num equals num2. [code] #include …

Member Avatar for Narue
0
197
Member Avatar for YoTaMiX

>sort a Randomized Dynamic 2D Matrix of Integers That could be a problem, but first I'll describe how you would do it with a real array. >how Qsort will help me? You cheat and give qsort something that it can work with. >if a 2D array is one big 1D …

Member Avatar for YoTaMiX
0
1K
Member Avatar for aminura

>any builtin function in c++ that converts a decimal number into binary number?? Maybe, depending on what you want to do with it. If all you want is a string, then the bitset<> class is ideal: [code] #include <iostream> #include <bitset> #include <climits> int main() { int dec; std::cout<<"Enter a …

Member Avatar for Narue
0
317
Member Avatar for server_crash

>while (! my_file.eof()) That's wrong. The eof member function wasn't designed to be used as a loop condition. Change it to this: [code] while (my_file.getline(info,sizeof(info))) [/code] Aside from that, there's nothing wrong with your code. It works perfectly on three of my compilers. Trim the code down as much as …

Member Avatar for iamthwee
0
5K
Member Avatar for server_crash

>Also, calling atof for a double maybe a bad idea - losing precision/etc Calling atof may indeed be a bad idea, but not for the reason you stated. atof returns a double, so the only loss of precision would come from the converted string not representing a value that a …

Member Avatar for server_crash
0
251
Member Avatar for mybrainhurts

>i still have the first problem of the program running continuously and never stopping. Where does it do this? Have you stepped through your program in a debugger to find out the loop that keeps repeating? There are only four places that this could happen: the two loops in getInput …

Member Avatar for Narue
0
156
Member Avatar for akshayabc

"tell me", "give me"; you realize that a large portion of programming consists of solving problems? You've decided that you want to write a parser, and that's a good project. You want to write one for C, which is far more than a mini-project that should take less than 30 …

Member Avatar for Narue
0
173
Member Avatar for waldis

Okay, let's make some observations on the goto code: [code] Y: A B if a GOTO X C if b GOTO Y X: D [/code] First, Y is always executed at least once because the test to GOTO Y is at the end of the "block". That suggests a loop …

Member Avatar for waldis
0
107
Member Avatar for davalend

>Why not write a Python program to translate C++ code to Python code? Probably (barring sneaky tricks that wouldn't count) because you'd effectively be writing both a C++ and Python parser and evaluator, not to mention a kickass AI to convert C++ into intelligent Python. Doable, but very very difficult …

Member Avatar for Narue
0
166
Member Avatar for vegaseat

>Does anybody know the limit of nested for loops in C or C++? 15 levels in C89, 127 levels in C99 and 256 in C++ are the minimum limits. Any decent compiler should take the standard's advice and not impose arbitrary limits, so if you hit pretty much any implementation …

Member Avatar for Narue
0
212
Member Avatar for JoBe

>Can someone tell me why this happens Sure. Since you're working with a pointer to an array, you need to dereference the pointer [b]first[/b] before you start trying to index the array. When you say *myarray[i][j], you're doing the indirection in the wrong order, with [i][j] first, then * because …

Member Avatar for Narue
0
134
Member Avatar for Virii

When it comes to a beginner's book on C++, there's only one choice: Accelerated C++ by Andrew Koenig and Barbara Moo. No other book I've read comes close to the awesomeness of that one as a first book, and I've read pretty much every text on C++ that you're likely …

Member Avatar for Rashakil Fol
1
201
Member Avatar for moznmar

>I'm not sure how I may move it to the other forum Done. In the future, you can either delete your thread with the thread tools provided nobody has posted a reply, or you can contact a moderator with admin powers on both the to and from forum (such as …

Member Avatar for Dani
0
205
Member Avatar for Kob0724

>Is it really a good program? It's okay, but I wouldn't even consider replacing Photoshop with the GIMP. All of my professional graphic artist and digital photographer friends agree. In my opinion, the GIMP is for systems that don't support Photoshop, free software fanatics who don't care about usability and …

Member Avatar for dojo
0
327
Member Avatar for freesoft_2000

That's pretty sappy, freesoft. Happy birthday, J, you're one year closer to dying of old age. ;)

Member Avatar for Asif_NSU
0
128
Member Avatar for shortLived

>I must have a bad version of Microsofts C++ compiler. Yea, that's it exactly. :rolleyes: :rolleyes: :rolleyes: >Does that work? No, it doesn't. Casting a floating-point value to an integral value truncates rather than rounds. The precision will be lopped off, leaving the whole value unchanged. This works though: [code] …

Member Avatar for Ancient Dragon
0
147
Member Avatar for red

There's no standard way (C and C++ are line oriented), so you'll need to tell us your compiler and operating system.

Member Avatar for red
0
151
Member Avatar for tayspen

>Any recommendations? A damp cloth doesn't work for you? Stop touching your screen or wash your hands more often. :rolleyes:

Member Avatar for server_crash
0
195
Member Avatar for masa

>I would like to know which is better. There's no difference if they both compile (they might not for user-defined types), pick which you find more intuitive. >Real C++ people...? I don't think I count as a real C++ person, but both call the primary (non-copy) constructor. The only noticeable …

Member Avatar for Dave Sinkula
0
213
Member Avatar for amrfalcon2004
Member Avatar for amrfalcon2004
0
97
Member Avatar for Jon182

>getline() is a method of std::string class and (I think) iostream. It depends on which getline you're talking about, but taken as a whole, your statement is incorrect across the board. You're mixing up the getline member function provided by std::istream (which uses C-style strings) and the getline function provided …

Member Avatar for Ancient Dragon
0
369
Member Avatar for Aldin

Hmm, I would say sscanf would be your best bet for a quick solution: [code] char *compare_number(char *first_number,char *second_number) { char *result; int x, y; sscanf ( first_number, "%d", &x ); sscanf ( second_number, "%d", &y ); return x < y ? first_number : second_number; } [/code] Naturally, you'll need …

Member Avatar for Narue
0
123
Member Avatar for amrfalcon2004

The first function call is the root, then any recursive call is a child of the root. Repeat for each child.

Member Avatar for Narue
0
53
Member Avatar for JoBe

>I'd hate to see you give a link to heavy The C++ standard would probably be categorized as heavy reading, so would any volume of Knuth.

Member Avatar for Ancient Dragon
0
139
Member Avatar for JoBe

[code] for (iter = scores.begin(); iter != scores.end(); ++iter) ++(*iter); [/code] Parens are there because a [b]lot[/b] of people have trouble with the associativity of operators that have equal precedence. It's right to left in this case, so you can safely remove the parens if you want and the dereference …

Member Avatar for JoBe
0
6K
Member Avatar for iamlearning

Something like this? [code] #include <stdio.h> #include <wchar.h> #define UNICODE(x) L#x int main ( void ) { wchar_t *p = UNICODE ( xyz\n ); fputws ( p, stdout ); return 0; } [/code] By the way, Unicode is only an encoding, not a storage specification. The actual storage is with …

Member Avatar for Rashakil Fol
0
191
Member Avatar for kahaj

[QUOTE=winbatch]Have a text file with 2 columns. Load the columns into a map<string,string> . Pick a random word from the map by using a function like srand() (keeping in mind that the number must be below the .size() of the map. if the answer they provide equals the value in …

Member Avatar for winbatch
0
185
Member Avatar for srishekh
Member Avatar for big_k105

[QUOTE=dkotyhh]:mrgreen: :mrgreen: :mrgreen: :cool:[/QUOTE] If you're going to do a necropost, at least make it meaningful. :mad:

Member Avatar for alc6379
0
129
Member Avatar for some one

>please post the way of calling Please read a book, or stop using libraries and features that are so far beyond you. cust is a vector of pointers to customer. You're trying to use a member function of the customer class as if it were a member function of the …

Member Avatar for iamlearning
0
123
Member Avatar for winbatch

>The alternatives I've thought of are as follows, but they all seem inefficient They [b]seem[/b] inefficient, or they [b]are[/b] inefficient? Chances are good that there's no performance issue and your time is better spent elsewhere.

Member Avatar for winbatch
0
4K

The End.