6,741 Posted Topics

Member Avatar for gujinni

So I tell you to go research how set_difference works and the first thing you do is post back here asking how it works with a different account? If you're that lazy, I won't bother ever helping you.

Member Avatar for gujinni
0
270
Member Avatar for graphixter
Member Avatar for gujinni

[QUOTE]Anybody know how to remove the duplicate characters in turbo c++.[/QUOTE] There are a number of ways. The brute force method is the probably simplest, where you copy each character that isn't in the other string to a result string: [code] function set_difference(str1, str2) result = "" for each c1 …

Member Avatar for theguitarist
0
266
Member Avatar for sergent
Member Avatar for Stefano Mtangoo
0
333
Member Avatar for jeanyl

I know how to solve your problem, but the exercise isn't about getting someone else to do your work for you, is it? Were I you, I'd start by studying up on how the predefined functions work to get a better idea of the algorithm at play.

Member Avatar for Narue
0
115
Member Avatar for Abhishek1857

An error like that suggests a broken compiler installation. The way to fix it is often a re-install of the compiler. Which compiler are you using?

Member Avatar for D33wakar
0
62
Member Avatar for TheWolverine

[B]>predefinedClassAObject_.pointerToClassBBase = &predefinedClassBObject_;[/B] [ICODE]predefinedClassBObject[/ICODE] is destroyed when the function returns. Your pointer is dangling because it was pointing to a local object.

Member Avatar for TheWolverine
0
403
Member Avatar for Rupindersingh

KeyboardProc was used before it was declared (C++ parses from the top down). You can either add a prototype before installhook(), or move the definition of KeyboardProc to be before installhook(). As for GetKeyState, you misspelled it: [code] #include<windows.h> static HHOOK hkb=NULL; HANDLE h; BOOL __stdcall DllMain(HANDLE hModule, DWORD ul_reason_for_call, …

Member Avatar for Rupindersingh
0
355
Member Avatar for gujinni

Are you just removing repeated characters, or truly removing duplicates? For example, what would the output be for "aaabaaa"? If it's the former, you can use std::unique quite easily to do the job: [code] #include <algorithm> #include <iostream> #include <string> using namespace std; int main() { string s("aaaaanffddddgjkh"); s.erase(unique(s.begin(), s.end()), …

Member Avatar for gujinni
0
190
Member Avatar for asrockw7

[B]>*endPtr = make_bunny();[/B] endPtr is already a pointer to bunny, which make_bunny() returns. When you dereference endPtr, it gives you a bunny object, so you're trying to assign a pointer to a bunny object. To assign the object returned by make_bunny(), you would dereference the result of the function call: …

Member Avatar for Narue
0
173
Member Avatar for riotburn

[B]>#ifndef __IN_HEADERNAME >#define __IN_HEADERNAME[/B] The rules for leading underscores in names can be tricky, and it's easy to stomp all over the implementation's reserved identifiers. Unless you're intimately familiar with the rules (which you're clearly not), I'd recommend not using any leading underscores at all.

Member Avatar for riotburn
0
281
Member Avatar for TheLittleEngine

[QUOTE]I always chringe when I see a predicate coded like this[/QUOTE] Why? Sure, you can make it more concise, but it doesn't strike me as cringe worthy.

Member Avatar for sfuo
0
164
Member Avatar for frogboy77

[QUOTE]At what point does conciseness become more important than readability[/QUOTE] I think a more interesting question is when does conciseness start to become readable? :) Code that I found obtuse ten years ago is simple now, and code that I find easy to read might baffle someone else. So where …

Member Avatar for BitBlt
0
91
Member Avatar for thecoolman5

The ctime library only supports a granularity down to seconds. For milliseconds you must either use a non-portable library (such as [URL="http://msdn.microsoft.com/en-us/library/ms724408"]GetTickCount()[/URL]). The Boost Date_Time library offers sub-second resolution if the underlying platform does as well (which Windows does). Standard solutions include dividing the result by CLOCKS_PER_SEC (be sure to …

Member Avatar for thecoolman5
0
891
Member Avatar for awslc

Are you using the correct format string for ParseExact()? Also note that if you just want to verify the formatting, TryParseExact() would be a better option due to returning bool instead of throwing an exception on failure: [code] CultureInfo culture = CultureInfo.InvariantCulture; DateTimeStyles style = DateTimeStyles.AssumeLocal; string time = "44:22.37"; …

Member Avatar for awslc
0
351
Member Avatar for sidra 100

You kids learn some crazy things. In the real world, there's only one methodology: [list=1] [*]Stare at the monitor with a confused expression [*]Type feverishly [*]Stare at the monitor with a distraught expression [*]Type feverishly [*]Make an angry face [*]Pound on the keyboard [*]Repeat at #1 until you have something …

Member Avatar for Rashakil Fol
0
352
Member Avatar for rayden150

By "doesn't seem to work" do you mean it fails to compile with an error along the lines of "'gotoxy' was not declared in this scope"? Because that's what I would expect, since gotoxy is one of those conio functions that isn't likely to be supported except on Borland compilers. …

Member Avatar for Frederick2
1
486
Member Avatar for sagar d

[QUOTE]I'd appreciate it if you didn't ask whether the attempt was successful or not.[/QUOTE] Way to answer the question without it being asked. ;) If you'd rather not have someone ask, then clearly the attempt was unsuccessful.

Member Avatar for imkj
-1
232
Member Avatar for bhallarahul

I think "arun" means invoke undefined behavior. Because that's what the program does.

Member Avatar for Narue
0
135
Member Avatar for CPT

[B]>cout<<user;[/B] user is a pointer, you need to dereference it first: [code] cout << *user; [/code] Though bare pointers are so passé. You should prefer smart pointers unless there's good reason to do otherwise: [code] string name, pass; cout << "enter name: "; cin >> name; cout << "enter password: …

Member Avatar for mike_2000_17
0
176
Member Avatar for learningcpp

[QUOTE]But recently I was writing a string class for myself only to learn and find out that definition of overlaoding of << can also be in the class, my question is why is this working?[/QUOTE] Magic. This definition is allowed, and has a few noticeable benefits: [list] [*]The function is …

Member Avatar for m4ster_r0shi
0
350
Member Avatar for ana_1234

[QUOTE]May someone please explain to me why the rename function isn't working?[/QUOTE] rename() sets errno. Call perror() to get a more useful error message.

Member Avatar for ana_1234
0
269
Member Avatar for pril

[QUOTE=Ancient Dragon;1597427]many compilers do not support that construct -- the compilers will require num_grades to be a constant. g++ is one of the few compilers that recognize that construct, which is new to c++0x, which is not yet an official version of c++ standards. Use a different compiler and you …

Member Avatar for Narue
0
171
Member Avatar for shaikh_t

[QUOTE=shaikh_t;1432860]Hello Can you suggest me some topics for final year projects in Web Designing Field?[/QUOTE] You could redesign my website for free and use it as a case study for your final project. :)

Member Avatar for shaikh_t
-1
86
Member Avatar for vergil1983

[QUOTE=WaltP;1596166]Could the reason he's [I]wasting his time[/I] is to learn to program, not outdo the compiler? There are many reasons to reprogram a built-in function -- first of which is to learn, not replace. Even in K&R they [I]wasted their time[/I] by programming built in functions -- in multiple ways.[/QUOTE] …

Member Avatar for deliezer
0
3K
Member Avatar for hutzy
Member Avatar for krabz01
Member Avatar for WaltP

[QUOTE]And why are programmers dissing it all of a sudden?[/QUOTE] I suspect a bunch of parrots just jumped on the bandwagon. Aside from the debugger interface, of which I wasn't a fan, I had no serious issues with Dev-C++ (either stable or beta). However, Dev-C++ is still a frozen project …

Member Avatar for pseudorandom21
0
1K
Member Avatar for krabz01

That's platform specific. You need to tell your OS to run that program on boot. What OS are you using?

Member Avatar for \007
0
99
Member Avatar for sadsdw

The new operator throws an exception of std::bad_alloc if the allocation fails. [rhetorical question] Did you catch the exception? [/rhetorical question]

Member Avatar for sadsdw
0
2K
Member Avatar for asrockw7

[QUOTE]I want more indepth info/lessons about C and I don't know where to go/begin[/QUOTE] More study never hurts. Reading code and participating on active C forums (as well as having a [URL="http://www.careferencemanual.com/"]complete reference[/URL]) will go a long way over time. But the best way to improve yourself is and has …

Member Avatar for asrockw7
0
427
Member Avatar for tomtetlaw

You still use DEVMODE. The dmPelsWidth, dmPelsHeight, and dmBitsPerPel members are what you want to update.

Member Avatar for tomtetlaw
0
1K
Member Avatar for hadiza
Member Avatar for Narue
-3
114
Member Avatar for Hesham Moustafa
Member Avatar for N1GHTS
0
167
Member Avatar for theguitarist

[QUOTE]The ignore command will get rid of any stray characters that are in there and it won't do anything if there are no stray characters, which is what you want.[/QUOTE] That's not quite correct. The ignore function will still block for input if the stream is empty. With one edge …

Member Avatar for m4ster_r0shi
0
189
Member Avatar for NathanOliver

The closest so far is gcc, at least version 4.6. Visual C++ 2010 has a few features, but not the most useful ones for the everyday programmer. If you're working on Windows, I'd suggest the [URL="http://nuwen.net/mingw.html"]nuwen build[/URL] of MinGW (it offers gcc 4.6.1). The problem with nuwen is that presently …

Member Avatar for NathanOliver
0
367
Member Avatar for Dingbats

[QUOTE]In your callback function inside the switch statement you have char A_Function(); . What is this for?[/QUOTE] It's a declaration for A_Function(). Placing declarations at deeper than file scope is an older style, and sometimes nonsensical, but there's not really anything wrong with it. [QUOTE]it sometimes outputs values < 1 …

Member Avatar for Dingbats
0
1K
Member Avatar for gujinni

[B]>#include <cassert>//what is the use of this???[/B] In that program it's not used. But <cassert> defines the assert macro, which is used for sanity checks: [code] void foo(int *p) { // Precondition: p is not a null pointer assert(p != 0); .... } [/code] Your questions boil down to "How …

Member Avatar for gujinni
0
376
Member Avatar for cesione

[QUOTE]i want to write a program[/QUOTE] [QUOTE]the program should be written in C i need it for "borland c"[/QUOTE] FYI, nobody here is going to write this for you. We'll help you write it yourself, but that's it.

Member Avatar for N1GHTS
0
2K
Member Avatar for tubby123

[QUOTE]Why ????? Because, all though the 'int' is saved in the file(in disk), a text doc wont be able to display because it only displays ascii characters.[/QUOTE] That has nothing to do with fwrite not working and everything to do with your misunderstanding of how fwrite works. fwrite directly writes …

Member Avatar for Narue
0
2K
Member Avatar for majorawsome

[QUOTE]how does it know what to get and set?[/QUOTE] Magic. The compiler basically turns it into this: [code] Blah __anonBlahBlah; Blah Blah { get { return __anonBlahBlah; } set { __anonBlahBlah = value; } } [/code]

Member Avatar for shiva07
0
174
Member Avatar for ana_1234

[QUOTE]Does anyone know how to cpy from one file and redirect to another.[/QUOTE] [CODE] #include <fstream> using namespace std; int main() { ifstream in("source", ios::binary); ofstream out("destination", ios::binary); if (in) out << in.rdbuf(); } [/CODE] [QUOTE]I need the Carriage return (0D) to be present.[/QUOTE] Text mode streams will convert whatever …

Member Avatar for Narue
0
346
Member Avatar for diafol

[QUOTE]Basically give the members the ability to make their own queries[/QUOTE] Or you could just, you know, remember the folks who rub you the wrong way. :icon_rolleyes: Ignoring the safety and performance concerns of supporting custom queries, consider that Daniweb's single biggest [URL="http://www.catb.org/jargon/html/P/PEBKAC.html"]PEBKAC[/URL] issue is a rampant failure to click …

Member Avatar for VernonDozier
0
156
Member Avatar for digital_ice7

[QUOTE]i want to return a string array so i can use it in my main function. how do i do this?[/QUOTE] You don't. Arrays aren't assignable, which means you'd be returning a pointer to either the array itself or a pointer to the first element. Since a local array is …

Member Avatar for digital_ice7
0
601
Member Avatar for simply_viks

Why do you need separate arrays? Just use the index array and a simple expression for figuring out the index.

Member Avatar for simply_viks
0
95
Member Avatar for David_Omid

I have a better idea. You tell us what problem you're trying to solve, and we'll help you come up with a better algorithm.

Member Avatar for David_Omid
0
168
Member Avatar for portege

Would it help if the code looked like this? [code] string digits = "0123456789abcdefghijklmnopqrstuvwxyz"; int index = value % base; s = digits[index] + s; [/code]

Member Avatar for raptr_dflo
0
3K
Member Avatar for nocloud

[QUOTE]I think this has something to do with the fact that I'm returning a const reference to an object that this function is treating as const.[/QUOTE] I think you're smoking crack if you made that connection with the given error. The problem is your syntax in calling size() and at(). …

Member Avatar for mrnutty
0
327
Member Avatar for sha11e

Not possible in the confines of standard C++. You would need either more control over the display, or more control over the input shell. What compiler and operating system are you using?

Member Avatar for mike_2000_17
0
246
Member Avatar for FoxInBoots

I notice you didn't ask a question. What exactly do you want help with that doesn't correspond to "please give me the solution"?

Member Avatar for Narue
0
192

The End.