6,741 Posted Topics

Member Avatar for gerard4143

[QUOTE]Let me state, as I have before, your assuming that the constant element is writable.[/QUOTE] That's generally a safe assumption with malloc. There's no way to do what you want without subverting the type system, so drop the const qualifier, or accept the risks.

Member Avatar for Narue
0
164
Member Avatar for abk07

This is a non-trivial program. First you need to be able to parse C code into tokens and recognize identifiers, which is a difficulty in and of itself. That would be the first step. Once you have a list of tokens, you need to determine the purpose of each identifier …

Member Avatar for WaltP
0
212
Member Avatar for Daita

[B]>typedef enum y;[/B] The enum keyword is only part of a type, while typedef may accept this line, you can't subsequently use [B]y[/B] in place of [B]enum[/B]. Though that effect can be created with #define: [code] #include<stdio.h> int main(void) { #define y enum int c; y colour {RED,WHITE,BLUE,BLACK}; printf("The assigned …

Member Avatar for Daita
0
162
Member Avatar for amna masood

The opening brace on line 67 isn't properly closed before the next case. This is what happens when you have a piss poor bracing style. :icon_rolleyes:

Member Avatar for amna masood
0
104
Member Avatar for Fortinbra

[QUOTE]Pointy-hair manager wants comfortable solution, not best solution.[/QUOTE] Sounds like a typical techie reaction to sound management practices. How do you define the "best" solution? Have you weighed the ROI of purchase, implementation, training, maintenance, and such against the "comfortable" solution? Have you considered technical support options? What about scalability …

Member Avatar for divin757
0
326
Member Avatar for shinsengumi

[QUOTE]1. creating a loop that continuously searches all occurrences of the substring until the end of the longer string 2. replace the substring with another string[/QUOTE] Yes, this pretty much defines the whole problem. Have you tried anything yet? I still don't see any posted attempts by you, either in …

Member Avatar for Adak
0
584
Member Avatar for london-G

It would look like this: [code] int add(int a, int b) { /* ... */ } int mul(int a, int b) { /* ... */ } int main(void) { /* ... */ switch (/* ... */) { case ADD: add(num1, num2); case MUL: mul(num1, num2); default: /* Handle bad input …

Member Avatar for london-G
0
182
Member Avatar for jowana

You've defined argv as a pointer to char. It needs to be either an array of pointers to char, or a pointer to pointer to char: [code] int main(int argc, char *argv[]) [/code] [code] int main(int argc, char **argv) [/code]

Member Avatar for jowana
0
275
Member Avatar for nadleeh

You don't sort a binary search tree because it's inherently sorted. Just use the last name as your key for insertion.

Member Avatar for Narue
0
122
Member Avatar for ekin5683

Close. You need to update your indices: [code] #include <iostream> int main() { int a[][3] = { {5, 3, 6}, {7, 2, 4}, {8, 9, 1} }; int row = 0, col = 0; for (int i = 0; i < 3; i++) { for (int j = 0; j …

Member Avatar for Narue
0
125
Member Avatar for touda

1) It is an object of the Production class. 2) It adds the Production object to the end of a collection of Production objects.

Member Avatar for Narue
0
149
Member Avatar for meet123321

[QUOTE]Well the deletion or search of a hash node based on key is not a quick operation[/QUOTE] That's always a possibility, but with a decent hash function you won't see enough collisions for the chains to grow especially long. [QUOTE]1 . using a doubly link list for chaining[/QUOTE] This adds …

Member Avatar for Narue
0
193
Member Avatar for cogitoergosum18

[B]>You have to check for denominator and if it is zero, then throw exception.[/B] I wouldn't use an exception in this case. Perhaps an assertion, because the user's input should be checked and sanitized long before the division takes place. In which case division by zero would be a programmer …

Member Avatar for pseudorandom21
0
242
Member Avatar for Ancient Dragon

[QUOTE]It returns the number of seconds since 1970[/QUOTE] Perhaps on your implementation. Here's the specification for the time() function in its entirety: [QUOTE=C99 Standard]7.23.2.4 The time function Synopsis 1 #include <time.h> time_t time(time_t *timer); Description 2 The time function determines the current calendar time. The encoding of the value is …

Member Avatar for Ancient Dragon
0
371
Member Avatar for major_tom3

[B]>The tab key doesn't take you to it, however. It most definitely should.[/B] Good suggestion, that's basic login box design. Though you might want to consider choosing the option to remain logged in if it bothers you that much. [B]>Only after submitting is it made clear that you have to …

Member Avatar for Dani
1
191
Member Avatar for happygeek

Yay, 1 million members, with 999,000 of them being one-off posters, banned spammers, or lurkers who add no value. :icon_rolleyes: I fail to see the benefit of fluffing the member count with shit and then bragging about it.

Member Avatar for TrustyTony
0
477
Member Avatar for Smartflight

[QUOTE]so time() function (argument being null) returns what?[/QUOTE] An unspecified arithmetic type containing the current system time in an unspecified format. Technically, using time to seed srand is non-portable due to the unspecifiedness of the time_t type and value. [QUOTE]Is there any communication between rand() and srand() function?[/QUOTE] rand() uses …

Member Avatar for Smartflight
0
267
Member Avatar for emreozpalamutcu

[QUOTE]Pick 1 i don't care how hard it is[/QUOTE] This is [i]your[/i] project, dude. Do some research and pick it yourself. CCleaner and Comodo are probably Win32 or MFC. However, if you're not already familiar with Win32 or MFC, the learning curve is not insignificant. Windows Forms is easier to …

Member Avatar for emreozpalamutcu
0
135
Member Avatar for fab2

You realize C supports an array type, right? When you find yourself naming variables x1, x2, x3, etc... that's a good time to consider an array.

Member Avatar for rubberman
0
210
Member Avatar for WolfShield

C++/CLI and C# are assembly compatible. You can write an assembly in one language and reference it from the other because they're both CLR-based languages. C# can also reference native C++, but it's not as simple as referencing an assembly because the native C++ DLL would be outside of the …

Member Avatar for WolfShield
0
565
Member Avatar for freebanana

[B]> What about those who are not famous...how can they prove that they deserve > to get a job as well paying as 100k like CS grads from prestigious U get? [/B] I'm self-taught, and not famous, yet I didn't have any trouble landing a high paying job multiple times. …

Member Avatar for e-papa
1
174
Member Avatar for Transcendent

I think a more appropriate question is what employer wouldn't laugh at such a certificate.

Member Avatar for rubberman
0
326
Member Avatar for mmartino
Member Avatar for RyanMcMillan
Member Avatar for RyanMcMillan
0
178
Member Avatar for thetwig

"%s/%s" won't do as you expect. The %s specifier reads anything and everything up to whitespace, so if your input is 1/2, the first %s will read "1/2". The second %s isn't executed because the next character doesn't match '/', so you're stuck with an uninitialized array. It should go …

Member Avatar for thetwig
0
173
Member Avatar for cayman

Clearly you didn't search very hard. The Windows API is C-based, with wrappers(MFC)/frameworks(.NET) sitting on top of it to support C++ and C#.

Member Avatar for cayman
0
111
Member Avatar for giggity
Member Avatar for super-duper
Member Avatar for Narue
0
145
Member Avatar for subith86

It's simply a way to distinguish between the prefix and postfix overloads. If the two didn't differ in the parameter list, they would be ambiguous.

Member Avatar for Narue
0
176
Member Avatar for comwizz

>I cannot figure out how to open the results/output window in Dev c++. Assuming I understand what you mean, the output window is a command prompt process that's created when you run your program and terminates when your program ends. Just hit F9 to compile and run, or choose the …

Member Avatar for deepshikha more
0
448
Member Avatar for jackmaverick1

The seed needs to be different each time for the sequence to be different. Most people prefer to seed based on the current time: [code] #include <iostream> #include <cstdlib> #include <ctime> int main() { std::srand((unsigned)std::time(0)); for (int i = 0; i < 10; i++) std::cout<< std::rand() % 5 <<'\n'; } …

Member Avatar for pseudorandom21
0
354
Member Avatar for harish9

[QUOTE]if we try to modify the content the result is undefined when i worked with gcc in unix.[/QUOTE] Correction: the result is [I]always[/I] undefined, regardless of compiler. Whether it "works" or not depends on how the compiler implements string literals and enforces modification. Even if it "works", you could still …

Member Avatar for rubberman
0
146
Member Avatar for moritz11

Automated language translators suck ass. No offense, but if your English is so weak that you must rely on one, it would be better to find a forum in your native language.

Member Avatar for Narue
-1
226
Member Avatar for caut_baia

It's absolutely desirable. Though after several failed attempts at increasing activity, I've kind of stopped trying. Maybe you'll have better luck. The signature is a good idea, I think I'll do that too.

Member Avatar for royng
3
236
Member Avatar for Khoanyneosr

[QUOTE]So, I've heard rumors that you can write web apps in C++. Is that true?[/QUOTE] Certainly. It's really not much more than reading from standard input, doing something, and writing to standard output, with some environment variable I/O here and there. A bit of a pain in my opinion though, …

Member Avatar for Khoanyneosr
0
151
Member Avatar for CSWalls

[QUOTE]So when I call "heapDelete(HeapItemType& rootItem)" function in the driver file.. I don't know what to pass as argument.[/QUOTE] It looks like you're just saving the top of the heap before removing it. rootItem would be any temporary variable you're using in your code: [code] while (!h.heapIsEmpty()) { HeapItemType top; …

Member Avatar for CSWalls
0
252
Member Avatar for frogboy77

[QUOTE]Are you people just genuinely good human beings?[/QUOTE] Far from it. In my case it's enlightened self-interest. By answering questions I have more control over the next generation of developers. Since these people will be my peers in the future, I want them to be reasonably competent.

Member Avatar for jon.kiparsky
0
269
Member Avatar for rajeevpareek

So close, yet so far. Isn't the preprocessor a bitch to work with for anything but the simplest of replacements? ;) [code] #include <stdio.h> #include <stdlib.h> #include <string.h> #define XSTR(x) #x #define STR(x) XSTR(x) int main() { FILE *fp; char filename[30]; #ifdef CORE strcpy(filename,STR(CORE)); #else #error "Must provide ...." #endif …

Member Avatar for thekashyap
0
7K
Member Avatar for royng

[QUOTE=royng;1507596]But there are hardly anyone there[/QUOTE] If nobody hangs out there because nobody is there, nobody will continue to be there. :icon_rolleyes: Why don't you add yourself to the number of people on IRC and then the count goes up by one. Get others to do the same and the …

Member Avatar for royng
0
435
Member Avatar for info04

>The program should also print the user's age on the console. Are you expected to take into account leap years? I don't see a naive implementation being much trouble, so you'll need to post your attempt before I give you any significant help.

Member Avatar for CECS
0
2K
Member Avatar for SeePlusPlus2

[B]>why did they use "Person *pPerson = new Person("Susan Wu", 32);"[/B] There's no real reason in this example, and it's also best practice to delete any memory you new. [B]>where did ".length();" come from?[/B] It's a member function of the std::string class. [B]>Also when "Rectangle *pRect" is put into a …

Member Avatar for rubberman
0
128
Member Avatar for bfprii

[QUOTE]For some reason after executing the value of pipebuf only contains the value of command, it does not contain the value of 100[/QUOTE] You're adding 1 to cr, which changes the Command object to which the pointer points. What you probably intended is [ICODE]DWORD *rooms=(DWORD*)cr;[/ICODE]. [QUOTE]It might be bad style, …

Member Avatar for Narue
0
160
Member Avatar for clutchkiller

>is there a more efficient way to do this? You mean without moving away from the console for non-sequential output? You could try pdcurses or something similar. At least that way you have more control, but if you're doing any kind of GUI-like interface or advanced drawing, you'd be better …

Member Avatar for Narue
0
2K
Member Avatar for DJSAN10

[QUOTE]wat is d need to typecast..??/[/QUOTE] First and foremost, function pointers and object pointers are incompatible with or without a cast. This cast is a very bad idea, and your book is likely written by an idiot unless it's showing how not to do things. To answer your question, the …

Member Avatar for Narue
-1
117
Member Avatar for Sadun89

Most image types have a specific format. If you insert bogus bytes into the format, it likely won't be recognized anymore. Your question is akin to "I smashed my cell phone, why doesn't it make calls anymore?". :icon_rolleyes:

Member Avatar for Sadun89
0
156
Member Avatar for Akill10

How many overloads of Spr_Blit do you have? If you have [iCODE]Spr_Blit(SDL_Surface*, SDL_Surface*)[/iCODE] and [iCODE]Spr_Blit(SDL_Surface*, SDL_Surface*, SDL_Rect*=NULL)[/iCODE], you're introducing an ambiguity: [code] Spr_Blit(surface1, surface2); // Which overload to use? [/code] Let's confirm everything you're trying to do rather than chase errors when there might be a more fundamental issue going …

Member Avatar for RyanMcMillan
0
154
Member Avatar for taumang

How were you expecting 7 to be printed three times when the first loop stops upon reaching 7 and the second loop decrements it immediately after printing?

Member Avatar for taumang
0
307
Member Avatar for n3red
Member Avatar for Narue
0
327
Member Avatar for blee93

[QUOTE=blee93;1500645]Bump![/QUOTE] I'll be happy to help you, after you explain what makes you so much more important than everyone else posting threads on this forum who got bumped down (not to mention one unlucky soul who fell off into the void of page 2 and will now never get help) …

Member Avatar for Narue
0
139
Member Avatar for khayabi

[QUOTE]can you tell me more about it ???[/QUOTE] Yes, but I'll give you a better option since realloc is generally not a good idea in C++. Use a std::vector object instead of an array, then you can call the [URL="www.cplusplus.com/reference/stl/vector/resize/"]resize[/URL] member function.

Member Avatar for WaltP
0
123

The End.