6,741 Posted Topics

Member Avatar for aminura

>This code compiles in VC++6.0 But it doesn't do what you seem to think it does. You're calling the constructor twice, thus creating [b]two[/b] objects. Only one of those objects do you pair with a variable. >Why does it do this way in visual c++? Because Turbo C++ is wrong …

Member Avatar for Narue
0
400
Member Avatar for compshooter

If your input is a C-style string, you can use strlen: [code] #include <cstring> std::size_t len = std::strlen ( buffer ); [/code] If your input is an std::string, it's even easier. Just use the size or length member functions. Alternatively, since it appears you're just reading a string, you can …

Member Avatar for Narue
0
334
Member Avatar for Niklas

>Is this something for a Beginner to do. CGI isn't something I would automatically recommend for a beginner, no.

Member Avatar for Narue
0
117
Member Avatar for server_crash

For non-leap years, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31. For leap years, add one to February using the formula: ((year MOD 4 = 0 AND year MOD 100 <> 0) OR year MOD 400 = 0)

Member Avatar for server_crash
0
301
Member Avatar for Niklas

>Since it seems like this is just gonna go one for ever saying "it works for me" someone just lock this thread. Maybe you should be more specific than "it doesn't work". It sounds like you're experiencing the first problem that most Dev-C++ users ask here, where the output window …

Member Avatar for Niklas
0
256
Member Avatar for Acidburn

>Replace strcpy(buffer, holdingArray[1]) with buffer=strdup(holdingArray[1]). strdup isn't a standard function, so you shouldn't expect it to exist since there was no mention of which compiler is used. Fortunately, it's easy to write: [code] char *copystr ( const char *s ) { char *rs = new char[strlen ( s ) + …

Member Avatar for Acidburn
0
257
Member Avatar for Ghost
Member Avatar for server_crash

>So the only difference is that members of a struct are public, and members of a class are private... Inheritance defaults to private for classes and public for structures too. Just remember that the default access for classes is private and for structures it's public.

Member Avatar for server_crash
0
164
Member Avatar for TheGroove

>But software? That just doesn't make any sense. Why not? A good understanding of the machine can improve code quality even in high level applications. As a good example, the system cache is becoming more and more important in high level data structures, and if you don't program with it …

Member Avatar for J_Search
0
128
Member Avatar for arunmisra
Member Avatar for Yandriel

Even something as "simple" as color is platform and often compiler dependent. But I'll assume Windows and guide you [url=http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/setconsoletextattribute.asp]here[/url].

Member Avatar for Narue
0
146
Member Avatar for Decoder

If you want any decent timings, you'll use a profiler. But you can use a poor man's timer with the standard library. For example: [code] #include <ctime> std::clock_t start = std::clock(); /* Stuff to time here */ std::cout<< ( ( std::clock() - start ) / (double)CLOCKS_PER_SEC ) <<'\n'; [/code] But …

Member Avatar for Drowzee
0
141
Member Avatar for SpS

>Am i right Barring sneaky tricks, you're right. But anything is possible if you're desparate enough to come up with a workaround that might work. For example: [code] #include <stdio.h> void change() { #define printf(fmt,x) printf ( "%d\n", 5 ) } int main() { int i=5; change(); i=10; printf("%d\n",i); return …

Member Avatar for SpS
0
148
Member Avatar for Dale Wemyss

Have you tried the Visual Basic forum? It's not hard to find, being a top level category and all.

Member Avatar for talkfreelance
0
72
Member Avatar for Acidburn
Member Avatar for Narue
0
111
Member Avatar for Drowzee

>I'm trying to implement a simple Cstring/Cstring map in my application >so users can specify what they want to see instead of the MAC address. The who and the what, now? It sounds like you want some sort of variant type, but I'm not sure. So be more specific and …

Member Avatar for Drowzee
0
469
Member Avatar for nir_kar

>was interesting to learn bout binary trees.... Done already, eh? That's impressive. It took me at least a year before I was comfortable with a fraction of the stuff in those tutorials. So I guess you read them and absorbed all of the information in less time than it took …

Member Avatar for Narue
0
138
Member Avatar for WVTrammell

>Where can I find specific instructions? System and compiler documentation.

Member Avatar for Ancient Dragon
0
89
Member Avatar for Soupy

I recommend Python as a first language. It's very forgiving, whereas my recommendation for a second language, C, is not.

Member Avatar for Dortz
0
145
Member Avatar for bonstubon
Member Avatar for Dortz
0
107
Member Avatar for djbsabkcb

>What is a two way templatized linked list in C++? It's a standard container: [code] #include <iostream> #include <list> int main() { std::list<int> my_list; for ( int i = 0; i < 10; i++ ) { if ( i % 2 == 0 ) my_list.push_front ( i ); else my_list.push_back …

Member Avatar for djbsabkcb
0
133
Member Avatar for j1979c

No, you have to simulate a few keystrokes with the Windows API function keybd_event. IIRC: [code] keybd_event ( VK_MENU, 0, 0, 0 ); keybd_event ( VK_RETURN, 0, 0, 0 ); keybd_event ( VK_RETURN, 0, KEYEVE­NTF_KEYUP, 0 ); keybd_event ( VK_MENU, 0, KEYEVENT­F_KEYUP, 0 ); [/code]

Member Avatar for Electrohead
0
307
Member Avatar for kohkohkoh

Don't try to bubble sort a linked list, it's bad enough for arrays. There are two sorting algorithms that lend themselves well to sorting linked lists: [url=http://www.eternallyconfuzzled.com/tuts/sorting.html#insertion]insertion sort[/url] and [url=http://www.eternallyconfuzzled.com/tuts/sorting.html#merge]merge sort[/url]. However, selection sort is also easy to visualize and to implement.

Member Avatar for kohkohkoh
0
185
Member Avatar for Ancient Dragon

>I need to generate a unique filename in a directory other than c:\temp Is this a directory that you specify or just any directory other than C:\temp? If it's the latter then tmpnam will create the file in the local directory. If it's the former then you're SOL and need …

Member Avatar for Ancient Dragon
0
272
Member Avatar for Micko

>copying from one file to another is a simple matter. On the surface at least. >I'm wondering how this is done in C++ A direct translation of C streams to C++ streams is: [code] #include <fstream> int main() { ifstream in ( "infile" ); ofstream out ( "outfile" ); if …

Member Avatar for Narue
0
578
Member Avatar for Auto

I would recommend asking for suggestions on [url=http://www.gamedev.net/]GameDev[/url]. They have resources for newcomers to game programming that Daniweb lacks.

Member Avatar for Kraken
0
563
Member Avatar for JoBe

>1) What is causing these warnings the first time I compile? The complete identifier is saved for debugging purposes when you compile in debug mode. However, because the internal identifier for templates can be ridiculously long, and the compiler only allows a length of 255 characters, everything after 255 characters …

Member Avatar for Ene Uran
0
694
Member Avatar for plshelpme1
Member Avatar for Lerner
0
863
Member Avatar for altheastronut

"Script" is a very broad term that typically doesn't apply to C or C++. Can you be more specific?

Member Avatar for Raven11
0
227
Member Avatar for JuanPabloD

>cout<<"Enter a["<<n-i<<"]:"; Gah! That's ugly. It could be formatted better to show the intention: [code] cout<<"Enter a["<< n - i <<"]:"; [/code] This basically prints "Enter a[[i]x[/i]]: ", where x is an index counting from the back of the array. If i is 0 and n is 5 then it …

Member Avatar for jwenting
0
209
Member Avatar for Mahen

>Must the programmer Flag this as an error and allow the user to correct >his input or make the program correct it for the user That's up to the programmer. It's certainly easier in the general case to force absolute correctness from the end user, but the added convenience of …

Member Avatar for Narue
0
126
Member Avatar for Ancient Dragon

With your experience, you don't need more than a good reference. I learned C# from "The C# Programming Language". That coupled with the material on MSDN is more than enough to get started with some serious programming.

Member Avatar for Toulinwoek
0
159
Member Avatar for SpS

Please don't start a new thread if your question isn't answered immediately. That said, there's no point in explaining the intricacies of a C++ implementation when you're so new to C++. Just take it on faith that there's a good reason, and expect to learn that reason when the time …

Member Avatar for Narue
0
350
Member Avatar for sara.rythm

>Sorry, change the "of any type" to "integers only". How about changing "macro to swap two arguments of any type" to "silly macro to break everything". It's still broken because you're modifying a variable more than once between sequence points. This isn't a difficult rule to figure out, I can't …

Member Avatar for Dave Sinkula
0
943
Member Avatar for jasna

Let me get this straight because your communication skills are lacking. You have a hash table with an exceptionally slow hash function (FNV would be faster, and since you need to handle collisions due to duplicates [b]anyway[/b], a cryptographic hash is a little much for table lookup). You're keying the …

Member Avatar for jasna
0
175
Member Avatar for Drowzee

>This problem was ignored in the command line version No, you were just unlucky enough that it didn't fail with as sirens, bells, and confetti. >But this is a cop out. It's still wrong because structure members are allowed to have padding between them and the padding is off-limits. If …

Member Avatar for Drowzee
0
2K
Member Avatar for shashankk

>It's one of the best C++ compilers out there, has the highest ANSI >compliance of them all (at least for the Win/Tel platform) and excellent performance. Um, no? Borland 5.5 is nice for an older compiler, but it's far from the most conforming, which is Comeau, and it fails to …

Member Avatar for kc0arf
0
385
Member Avatar for bops

>[COLOR=Red]cin[/COLOR].getline(linebuffer,100); This should be [code] [COLOR=Blue]file[/COLOR].getline(linebuffer,100); [/code] The program is stopping dead in its tracks because the loop is keyed on whether the file is empty or not, and you never read from the file, just standard input. Also, using eof() as a loop condition is wrong because the eofbit …

Member Avatar for bops
0
254
Member Avatar for harshchandra

>whereas cout is a just a 'class' with an output operator as ancient >dragon explained and therefore doesnt provide an argument There's nothing wrong with using the result of cout's << operator in a conditional statement as you seem to think. All standard streams have a conversion to void* which …

Member Avatar for harshchandra
0
201
Member Avatar for neologic

>Whats wrong with this class??? It has no point because the standard library already provides an excellent string class. That said, what is it not doing that you want it to? Don't expect us to test and debug your program just because you didn't give us enough information about your …

Member Avatar for Stoned_coder
0
122
Member Avatar for cjm771

>If someone could write out the necessary code, that would be great! I'm sure it would be, but that's not how it works. You write the code, and we help you with it. Too many people show up expecting us to write everything for them, and that's not the point …

Member Avatar for cjm771
0
4K
Member Avatar for winbatch

fillMe is a copy of the pointer, so you're allocating memory to a copy, then the copy is destroyed, thus destroying your only reference to the memory. This is affectionately called a memory leak. The solution in C is to pass a pointer to the pointer so that you can …

Member Avatar for Narue
0
272
Member Avatar for nico

>c assigns a negative ASCII value to some symbols No, C assigns a negative [b]integral[/b] value to the variable and the system happens to have a printable representation for that value. It doesn't mean that it's ASCII. >I expect that in your system char == unsigned char. No, if that …

Member Avatar for Sutanu
0
5K
Member Avatar for kokopo2

Well, what constitutes a number? How about an operator? Determining if the token is a valid operator is simple, just keep a list of valid operator tokens and compare the string. Numbers are harder unless you restrict yourself to the basic integers where the only valid characters are, for example, …

Member Avatar for Dave Sinkula
0
455
Member Avatar for nanosani

>Q.E.D. Yes, but is it correct? The question clearly states "variables" yet your cute little trick will only work on integral types. What about pointers? If a and b are pointers and they point to the same object, you certainly won't get a swap out of this.

Member Avatar for Daishi
0
317
Member Avatar for konacious

>int occ = 0; What is occ supposed to do? >if (name[p] == '\0') name wasn't initialized, so this is undefined. There's no need for the array, just take characters as you get them: [code] void readAndCount (int &numWords, int letterCount[]) { char c; do { if ( !cin.get ( …

Member Avatar for konacious
0
282
Member Avatar for 3265002918

>it says that there arent any errors onvisual studio 2003 .net That's nice, and your point is? I get the same lack of error, but that doesn't make it any less wrong. The only difference between you and me is that I know it's wrong and you're trying to give …

Member Avatar for 3265002918
0
345
Member Avatar for Micko

Think of a callback as the poor man's polymorphism. By forcing some code, say from a library, to use a well defined and portable interface, clients can supply the interface and change the behavior of the library without touching the library code. A good example is a sorting function. If …

Member Avatar for Micko
0
118
Member Avatar for gabe522k3
Member Avatar for faisyshah

[quote] please explain in detail how computer work.in term of computer processing cycle.for example when we start compuer how comper parts(ram,processor,hard disk,busses,etc )perform task or work.and how windows work. [/quote] This is a joke, right? Go do your own homework!

Member Avatar for tayspen
0
448

The End.