6,741 Posted Topics

Member Avatar for rati

[B]>Can anyone explain me how the vtable and vptr are created >in case of virtual base class and what all values it contains.[/B] First and foremost, each compiler will do these things in a different way. The C++ standard doesn't even mandate that virtual tables be used at all, much …

Member Avatar for Narue
0
260
Member Avatar for ShrewdSpirit

[B]>Where's the $?[/B] Where? Everywhere. You'll find that wherever you work, the salaries have a tendency to correspond to the cost of living. If the salaries are lower, so are the costs of living in that area. As long as you're a top tier IT dude, you'll get top tier …

Member Avatar for Narue
0
123
Member Avatar for asator

[B]>am an engineering student and took the AI course by mistake ![/B] So drop the course. You can do that, you know.

Member Avatar for Nick Evan
-3
73
Member Avatar for adi.shoukat

[B]>i want to read the text that i enter in textFields on Internet explorer ....[/B] Sounds very suspicious. Can you come up with a reason why you want to do this that doesn't amount to malware?

Member Avatar for Narue
0
187
Member Avatar for mahela007

[B]>How would it relate to 'kernels as an abstraction layer for hardware'? [/B] The kernel talks to the hardware so that applications don't have to consider every possible hardware configuration. It would really suck to require a different build of Microsoft Word because you bought a new monitor, ne?

Member Avatar for mahela007
0
84
Member Avatar for mahela007

[B]>Anybody?[/B] Probably not, seeing as you appear to have ignored the previous replies to the same question in another thread. We're generally hostile toward people who waste our time. p.s. Don't bump your threads. It's extremely rude and antisocial.

Member Avatar for mahela007
0
85
Member Avatar for pdk123
Re: info

In your current code you declare num_elements both in the global scope, and locally within main. When multiple variables from different scopes have the same identifier, the one from the most local scope will be used. So the num_elements in main is hiding the global num_elements. sample does indeed work …

Member Avatar for pdk123
0
202
Member Avatar for D_switch

[B]>it won't work the way i want it[/B] So fix it. We're not the psychic friends network, here to solve all of you problems with a crystal ball and smile. You wrote the damn program (and it's very short!), so you should be able to figure out why it's not …

Member Avatar for gerard4143
0
116
Member Avatar for Iam3R

[B]>whats the story.[/B] The story is that the code you posted is not valid C. You're likely relying on a compiler extension that allows nested function definitions. What compiler are you using?

Member Avatar for Aia
0
93
Member Avatar for sknake

Methinks this poll is biased. You're missing a few moderators, including our illustrious super mod...

Member Avatar for cwarn23
1
313
Member Avatar for Iam3R

[B]>i read that the precision of float is 6 digits and double is 10.[/B] No, the precision of float is FLT_DIG and double is DBL_DIG, where both of those macros are defined in <float.h>. [B]>but it is showing only 6 for both.[/B] Yes, that's the correct behavior. If you print …

Member Avatar for Iam3R
0
496
Member Avatar for ganmo

Your code is C++, not C. In C++ void* conversions are not implicit and require a cast.

Member Avatar for ganmo
0
105
Member Avatar for blahbla

[B]>It seems that your function fails to check the ends of the arrays. >Please revise your code.[/B] That doesn't look like a compiler error. Did your teacher tell you this?

Member Avatar for blahbla
0
220
Member Avatar for onruli
Member Avatar for onruli

Five days, huh? Maybe you aren't cut out for programming? Post your code and somebody will try to help you.

Member Avatar for Narue
0
46
Member Avatar for "Alex"

Two replies (one from a mod), and both are horrid. You both completely missed the fact that the <string> header wasn't included, which means any use of the std::string try (qualified or no) will fail miserably. *sigh* Here is the corrected[1] code. I added the <string> header and qualified the …

Member Avatar for Narue
0
133
Member Avatar for didijc

You say you want to parse HTML, but to what end? Are you writing a browser? Something to automatically check your stocks? A spider, perhaps? The answer to that question will determine the lengths you need to go to write the parser.

Member Avatar for didijc
0
549
Member Avatar for kapil.muni1020

Please post the error and specify which compiler you're using. Also, are you compiling as C or C++?

Member Avatar for Ancient Dragon
0
111
Member Avatar for edherbs135

Not unless you change your data structure or make certain assumptions based on the order of the array elements. But filtering one random array based on criteria from another random array, no, you're pretty much stuck with the brute force naive methods.

Member Avatar for edherbs135
0
86
Member Avatar for big_guy_bri
Member Avatar for Narue
0
105
Member Avatar for T-Dogg3030

[B]>With that in mind generating a random character is easy: >char randomUpperCase= 'A' + rand() % 26; >char randomLowerCase= 'a' + rand() % 26;[/B] Easy if you ignore the portability issue. The only characters that are guaranteed to be consecutive in C++ are the decimal digits '0'-'9'. Your code in …

Member Avatar for mrnutty
0
304
Member Avatar for 9868

[B]>Is there any suggestion for improvement[/B] Yes, I can recommend improvements: [B]>scanf("%d",&n);[/B] Always check your input functions for success. Especially with user input, and more especially with functions that are being used inappropriately (like scanf for user input), you need to take care that it read what you wanted. You …

Member Avatar for Narue
0
93
Member Avatar for T-Dogg3030

[B]>int nulls=atoi(argv[2]); >int arry[nulls];[/B] Nope, sorry. C++ doesn't allow an array size that isn't a compile-time constant. [B]>const int nulls=atoi(argv[2]); >int arry[nulls];[/B] Bzzt! Wrong! nulls is still not a compile-time constant despite being qualified as const. This is because to be truly compile-time, the variable needs to be qualified as …

Member Avatar for Narue
0
199
Member Avatar for UberJoker

I'm very much not interested in reading that mess of unformatted code, so I'll simply give you two links that might help: [URL="http://www.eternallyconfuzzled.com/tuts/datastructures/jsw_tut_avl.aspx"]AVL Tree Tutorial[/URL] [URL="http://www.eternallyconfuzzled.com/libs/jsw_avltree.zip"]AVL Tree Implementation[/URL]

Member Avatar for UberJoker
0
115
Member Avatar for Iam3R

[B]inline[/B]: Similar to C++'s inline keyword. It gives you the option of telling the compiler that you want inline expansion rather than real function object code. Inline functions are a safer and easier to use alternative to function macros: [code] static inline swap ( int *a, int *b ) { …

Member Avatar for Iam3R
0
2K
Member Avatar for icygalz

And what was your answer? We're not here to do your homework for you. p.s. Use code tags for code. It's not like Daniweb doesn't slap you in the face with instructions each time you post. p.p.s. At least this question is solvable, unlike your other one.

Member Avatar for icygalz
-3
183
Member Avatar for icygalz

[B]>I cannot change the main function[/B] Sucks for you then, because the error is in main and can't be fixed from findMax. You have an uninitialized pointer. [B]>pToMax = &arr[0]; >//should be >pToMax = &arr;[/B] No, that changes the the meaning of the expression and introduces a type mismatch. It …

Member Avatar for Narue
1
4K
Member Avatar for spear64

No code, no help. This is obviously homework, so you need to read Daniweb's rules one more time before posting again.

Member Avatar for jbisono
0
119
Member Avatar for klackey19

[B]>Actually it does compile. [/B] TYPE is never defined, which causes a relatively large number of errors regardless of which compiler one uses. You also rely on non-portable behavior that breaks two of my compilers (I suppose TYPE is also a compiler extension, since you claim the code compiles on …

Member Avatar for klackey19
2
308
Member Avatar for Stefano Mtangoo

<psychic_debugging> I'm willing to bet that you copied the code from that site without adding the necessary scaffolding. For example, executable (as opposed to declarative) code needs to be wrapped in a function: [code] #include <windows.h> // Assuming this for Sleep #include "libwmp3.h" int main() { /* create class instance …

Member Avatar for Stefano Mtangoo
0
195
Member Avatar for kfg20

[B]>One way I would approach this, is not to worry about templating the >function at all until you get a function that does what you want it to do.[/B] Good advice. This is especially useful when writing large template classes due to the "feature" of not instantiating templates that aren't …

Member Avatar for Narue
0
653
Member Avatar for jephthah

Being busy and lack of interest conspire to keep me away. Rest assured, when(if) I return full force, you can look forward to old school Narue replies.

Member Avatar for The Dude
2
160
Member Avatar for klackey19

[B]>the compiler is actually giving an error though -- "invalid operands to binary *" [/B] The compiler is actually right. Multiplication for pointers is nonsensical. Why don't you tell us what you're trying to do and we can tell you how to go about it, because you clearly need someone …

Member Avatar for Narue
0
141
Member Avatar for tomtetlaw

[B]>How can they possibly do this, how would you get it to compile itself?[/B] [LIST=1] [*]Write an initial compiler for your new language in an existing language (ex. the first Pascal compiler was written in Fortran). [*]Write a bootstrapping compiler for your new langauge with that initial compiler. [*]Your new …

Member Avatar for Narue
0
95
Member Avatar for neithan

Use nombres the same way in edadMedia as you did in main (ie. as an array). However, I strongly recommend that you pass the size of the array as well so that you can avoid bogus indexes in edadMedia. A few notes: [B]>printf("Accediendo a %s:\n", filename); >FILE *file = fopen(filename, …

Member Avatar for Narue
0
117
Member Avatar for Soileau

[B]>array1[]; >array2[];[/B] A type and a size are both required. [B]>length;[/B] A type is required. [B]>name1.array1[4] = {3,0,7}; >name1.array2[4] = {0,15,0,-4};[/B] Alas, arrays can't be assigned to like that. You need to do this during the initialization of the structure instance, or manually assign to each element: [code] #include <stdio.h> …

Member Avatar for dan63043
0
126
Member Avatar for sexyzebra19

If you want to be able to roll back changes, store the contents of the vector in a backup vector before making the changes. Alternatively, you could reverse your algorithm to obtain the original values, but the backup vector is easier and faster (at the cost of extra memory usage).

Member Avatar for sexyzebra19
0
116
Member Avatar for SimonLeefe

If you know how to use arrays, and you know how to use FILE pointers, you know how to use arrays of FILE pointers. There's really nothing tricky about it except for the number of files you can have open at any given time. The FOPEN_MAX macro in stdio.h tells …

Member Avatar for SimonLeefe
0
200
Member Avatar for denizen08

Your polynomial class has a pointer member and a destructor, but no user-defined copy constructor. Sounds like a one-way ticket to the exact error you're describing.

Member Avatar for Narue
1
170
Member Avatar for kryz

[B]>I'm not sure how to get the vowels to show up in Case A. [/B] The problem isn't the pointer, it's the fact that you're returning a pointer to a local array. When the function returns, the memory for that array is reclaimed. In other words, it's not yours anymore. …

Member Avatar for Clinton Portis
0
789
Member Avatar for daviddoria

Obviously you can't overload the [][] operator because no such operator exists. What you need to do for your MatrixClass class is overload the [] operator to return another type that also overloads the [] operator.

Member Avatar for Narue
0
97
Member Avatar for duke.tim

[B]>You can also do this: <snip conio.h crap>[/B] You [i]can[/i] do that...but don't teach it to others. Using conio.h is like bumping uglies with a fat chick. A lot of guys might do it, but they don't talk about it. Such is the way with bad programming practices.

Member Avatar for Nick Evan
0
261
Member Avatar for nunchuckie

[B]>if the char "c" lies between 48 and 57 then print it , or else ignore[/B] Congratulations! You've introduced a completely unnecessary dependency in your program due to sheer ignorance and reduced the readability of your program at the same time. Double whammies like that are rare. Compare and contrast: …

Member Avatar for rahul8590
0
137
Member Avatar for abdelhakeem

The names of your variables go away after compilation, so you can't query them at runtime. Instead of trying to do something magical, why not store a name in your structure and use that? Of course, your program is missing a lot of required logic to make this work. Here's …

Member Avatar for abdelhakeem
0
106
Member Avatar for SagarSonu

[B]>pBuffer[26627664] = '\0';[/B] You've got an off-by-one error. Do try to remember that array indexing in C is based on an offset, not an item count. pBuffer[0] is the first item, so pBuffer[N-1] is the last item, and pBuffer[N] is an overflow error. [B]>Char* pBuffer = (Char*)new BYTE[26627664];[/B] How are …

Member Avatar for Narue
0
109
Member Avatar for maverick405

[B]>then all you have to do is use a for loop, start from >strlen(str)-1 , to >= 0 and print out at index i. [/B] It's not that simple. Read the question more carefully. What the OP wants is word reversal within a sentence, where a word is a sequence …

Member Avatar for Narue
0
82
Member Avatar for tarakant_sethy

[B]>what is the difference between these two ?[/B] The only difference is in the details. Assuming your "factory design implementation" is some other variant of the factory pattern from a factory function, you've simply described two ways of doing the same thing.

Member Avatar for Narue
0
69
Member Avatar for ylchen

[B]>I understand for quick solutions you would follow AncientDragon's sage advice.[/B] Actually, AD's advice is ideal: Student: "How do I use printf with templates in C++?" Teacher: "Don't use printf." The only reason the OP is using printf is because he's new to C++ and used to C. Giving a …

Member Avatar for Ancient Dragon
0
2K
Member Avatar for confusedndazed

[B]>Set UserInfo = LastName = “ , “ + Birthdate [/B] My brain has trouble parsing this line. Perhaps you meant: [code] Set UserInfo = LastName + “ , “ + Birthdate [/code]

Member Avatar for Tales
2
102
Member Avatar for red999

Typically you pass in any object derived from istream or ostream (such as cin, cout, any fstream object, any stringstream object, etc...). Equally typically, the return value is used to get the result of the operation: [code] if (!foo.read(std::cin)) panic(); foo.print(std::cout); [/code]

Member Avatar for red999
0
298

The End.