6,741 Posted Topics

Member Avatar for blackdove

>I don't know exactly what your professor gave you Probably something akin to bad Java via C++. Professors have a tendency to do that. :rolleyes:

Member Avatar for Nedals
0
193
Member Avatar for ninja

The only way your post could be less coherent is if you used l33t speak. :rolleyes:

Member Avatar for Lord Soth
0
160
Member Avatar for Kashif
Member Avatar for Kashif
0
109
Member Avatar for jack223

>Trace the Partition function on the following array What's the function? There are several ways of partitioning an array, and each algorithm would have a different execution trace.

Member Avatar for Narue
0
210
Member Avatar for Micko

>problem is how to implement, say a linked list in Python, since it doesn't have >pointers, or even static types so how this could be implemented is pretty unclear to me Python is kind of screwy if you're used to a strongly typed language like C++ (or even C!). To …

Member Avatar for Ene Uran
0
542
Member Avatar for musicmancanora4

If you have a new question, start a new thread. Since you seem to have solved your old problem, I'm locking this thread. Let me know if I've done so in error.

Member Avatar for Narue
0
133
Member Avatar for some one

>i need to have some application of the priority queue Homework? Read our rules, please. Not homework? Use your imagination. It's not terribly difficult to think of applications for a priority queue if you know what one is. >thanks but i just need the applications of the priority queue This …

Member Avatar for Narue
0
109
Member Avatar for prasath

>is it possible to declare constructors as private? Yes, and it provides some valuable functionality to do so occasionally. >if yes, will some one explain me how to do it Just place the constructor declaration in the private section rather than the public section: [code]class test { public: test ( …

Member Avatar for Narue
0
75
Member Avatar for rio

Could you be more specific when you say "relationship"? That's a really broad term.

Member Avatar for rio
0
148
Member Avatar for Dabdob
Member Avatar for Lerner

>I'll write it off as another quirk in VC++6.0 and go with what I have. Yes, it's a bug. Get a new compiler. You'll eventually get tired of the endless limitations, and the workarounds required to write anything but trivial C++.

Member Avatar for Narue
0
135
Member Avatar for degamer106

You compare the contents of two strings with the strcmp function in the <string.h> header. What you're actually doing with the == operator is comparing two memory addresses. Since the two strings are extremely unlikely to be located at the same address, your comparison will fail and the sort will …

Member Avatar for degamer106
0
65
Member Avatar for tiffani

First, format your code so that it's readable. Then post the code using code tags so that the formatting isn't lost. Finally, give way more information than "it doesn't work" and "seg fault". Despite how it may seem, we're not here to be your testers and debuggers. Please consider that …

Member Avatar for Narue
0
153
Member Avatar for cinderella

>i think so the program is perfect Then you're not qualified to help. The code is *horrible* in so many ways. However, because I'm pressed for time, I'll refrain from describing all of the problems in detail and focus only on the search function. >booknum = &i; What's this? >if(temp->booknum …

Member Avatar for Narue
0
175
Member Avatar for musicmancanora4

>it has to print the grid like this and im havin trouble with the formatting Do you need to print the grid as well as the array contents? If so, it takes a smidge more work. :) [code]for ( i = 0; i < limit; i++ ) { /* Print …

Member Avatar for Narue
0
152
Member Avatar for Kushal Thakkar

>i want to know everything abt container classes. Ooh, me too. Start by learning how to use them with books that focus on the standard library and references that inform you of their capabilities. Then learn their limitations through experience and asking lots of questions. Finally, attempt to implement them …

Member Avatar for Narue
0
126
Member Avatar for yep2678

[code]next_char: mov al,message[ebx] mov result[ebx],al add al,32h[/code] Watch your order of operations. You save the character to al, then copy al to the result string, *then* modify al. Also, if you're converting an ASCII letter to upper case, you need to subtract because the upper case letters are less in …

Member Avatar for Narue
0
468
Member Avatar for Podge

>I am not really a beginner looking for some to teach me from scratch. Then why is this forum inadequate? If you don't need to learn from scratch then you really are better off teaching yourself and asking for help when you get stumped. It saves you the money and …

Member Avatar for Podge
1
202
Member Avatar for ultirian

Let's say you have a list of 40 people. You can pick a random one and then mark it as chosen (somehow): [code]for ( int i = 0; i < n; i++ ) { int r; do r = rand() % 40; while ( list[r].chosen ); list[r].chosen = true; } …

Member Avatar for ultirian
0
164
Member Avatar for webmasts

>I need to find out if the length of the integer (string) is less than 5 digits. Um... [code]if ( s.length() >= 5 ) { // Proceed } [/code]

Member Avatar for webmasts
0
128
Member Avatar for myloginh10

>Graph theory (vertex-edge) is one of popular projects for uni. >students, here is a link which includes source code and explains. This is borderline on breaking the rules, but I won't remove the link because it doesn't *quite* cross the line. Keep in mind that if a post stinks of …

Member Avatar for Narue
0
87
Member Avatar for beuls

>how can you read a hexadecimal number in c++? is there any option with cin/ The std::hex modifier works with input streams: [code]#include <iostream> int main() { int x; std::cin>> std::hex >> x; std::cout<< x <<'\n'; }[/code] Type in 1B (or 1b), and the output will be 27, which is …

Member Avatar for beuls
0
5K
Member Avatar for gpta_varun

>Was just working on detecting memory leaks Programmatically or are you just working on setting up guidelines? >Where can i get the actual code implemention of new and delete functions in C++ Wait, what? This varies with every implementation, and the internal mechanism should be largely irrelevant even for a …

Member Avatar for gpta_varun
0
135
Member Avatar for Dabdob

>anybody here?!! Yes, but let me make it clear that just because you ask a question, it doesn't mean you're entitled to an answer. We're all volunteers here, and we aren't obliged to help you if we don't want to. Bumping your thread on the assumption that you deserve an …

Member Avatar for Narue
0
100
Member Avatar for Dabdob

>either unconditionally or after testing the result of "CMP: instruction.. Or any instruction that modifies the appropriate flags. For example, I could say: [code]dec ecx jz foo [/code] To jump to foo when ecx reaches 0. Sometimes it's more efficient to avoid cmp in favor of a more implicit test. …

Member Avatar for Dabdob
0
115
Member Avatar for shlinky

>I have a class called anItem which is defined something like this I'll assume it's "something" like that rather than exactly like that because that class won't compile (no trailing semicolon) and even if it did would be unusable because all of the data members are private with no way …

Member Avatar for dwks
0
154
Member Avatar for nexes300

[code]normalXPrecedence["x"] = 1; normalXPrecedence["x^2"] = 2; normalXPrecedence["x^3"] = 3; normalXPrecedence["x^4"] = 4; normalXPrecedence["x^5"] = 5; normalXPrecedence["x^6"] = 6;[/code] Are these lines actually in the global scope, or are you summarizing by removing the function that they reside in? Only declarations and definitions are allowed in the global scope, and assignment …

Member Avatar for nexes300
0
532
Member Avatar for kjones2k1

[code]float mean(const double data[][3], int rows, int columns);[/code] Yes, you must specify all but the first dimension, though if you want to include the size of the first dimension as well, that's okay too.

Member Avatar for kjones2k1
0
279
Member Avatar for vicky_dev

>what exactly is segmentation fault or access violation and exactly when does it occur? A segmentation fault is when you access memory outside of your address space and the OS politely asks you not to do that. >Why does the following program work correctly Undefined behavior can do anything, including …

Member Avatar for Salem
0
74
Member Avatar for Podge

>Is this concept flawed? No, that's a good way to do it. Create a class that wraps the types you want and supports sorting on the fields you want, then create a container of objects of that class.

Member Avatar for Lerner
0
118
Member Avatar for benyam_dessu

Just use what you're familiar with on Turbo C++. If Dev-C++ complains about a header, remove the .h suffix, and place "using namespace std;" after your headers. That should take care of most of your immediate issues.

Member Avatar for iamthwee
0
87
Member Avatar for degamer106

>while ((ch = getchar()) != NULL && ch != '\n') NULL is not the same as EOF, and it never will be. Also, ch should be declared as int because char might be unsigned and EOF is a negative value. >If there's some kind of space saving technique please let …

Member Avatar for degamer106
0
91
Member Avatar for SiliconSpec

>why then is it apparently ok to mix C with C++. If C++ supports the features then the only problem is with stuffy people who think that C++ should be pure...for some skewed definition of "pure". :rolleyes: For example, C-style strings are perfectly acceptable to the C++ standard. There's nothing …

Member Avatar for iamthwee
0
1K
Member Avatar for c++34

>İ dont know anything about file IO That's nice, so what are you going to do about it? If you said "Post to Daniweb and hope someone does my homework for me", you get a slap on the wrist. If you said "Open my book and try to figure it …

Member Avatar for c++34
0
132
Member Avatar for jack223

>Which of the following dynamically allocates an object of type ourClass? e, none of the above. >In the second line, which version of mem() is accessed? c, this code causes an error.

Member Avatar for jack223
0
183
Member Avatar for jack223

You only need to declare a function as virtual at the highest level. Any child classes will implicitly declare the same function as virtual, so there's no need for an explicit declaration, but it never hurts to be explicit. So b is the required answer and a is optional.

Member Avatar for Narue
0
95
Member Avatar for shahnazurs

That's a non-trivial program that involves working with the different image file formats (wotsit.org is your friend) and drawing them accordingly using a non-standard graphics library. As such, your question is far too broad for us to help with. Be more specific.

Member Avatar for shahnazurs
0
117
Member Avatar for francis adepoju

>1) I do not know how to start/initiate my data upload to the PC First you need to have a clear idea of what 'upload' means to you. Are you gathering the data on another system and transferring it through a network to the PC? Are you reading from a …

Member Avatar for francis adepoju
0
94
Member Avatar for francis adepoju

Please reply to your existing thread rather than start a new one with *no context* at all. By the way, this thread will be locked so you're encouraged to follow my advice.

Member Avatar for Narue
0
86
Member Avatar for Yustme

The XOR operator is usually used to flip bits. You can flip a single bit by making a 1-bit mask (shifting 1 to the proper bit position) and then XORing the value with your mask: [code]inline unsigned flip ( unsigned x, unsigned bit ) { return x ^ (1UL << …

Member Avatar for Narue
0
2K
Member Avatar for degamer106

There's no reason to use ungetc in that program. Can you be more specific about the question, because it sounds like information is being lost in translation.

Member Avatar for Narue
0
463
Member Avatar for perlsu

>I would like to know whether the dynamic memory pointer is still >available even after freeing the allocated memory. No, it's not. When you free memory, you must reassign the pointer to memory that you own before you can dereference it again.

Member Avatar for Narue
0
99
Member Avatar for shahnazurs

>Shall i dowload this MASM free? [url=http://www.masm32.com/]masm32[/url] is pretty good from what I hear. I only have a passing familiarity with the syntax, but my understanding is that the macros are exceptionally powerful. If you like that sort of thing. Since you have experience, that might be your best bet. …

Member Avatar for Narue
0
103
Member Avatar for vamsi.rgiit

>please check it and give me suggestion. Um...no. We're not going to error check your homework for you; that's your job. If you have a specific problem or question, we'll be happy to assist.

Member Avatar for Lerner
0
61
Member Avatar for deutsch

>Can you still use BIOS functions win 32 bit programs? No, the BIOS and DOS interrupts are strictly 16-bit, so a 32-bit program cannot use them. However, if you write a 16-bit program you can use them to a certain extent, but I would question why you need to on …

Member Avatar for Lord Soth
0
110
Member Avatar for Sun

>idon't know how to get the ASCII of any number or character char is a little int, so you don't need to do anything special to get the numeric value of the character (ASCII isn't always used). However, since ASCII isn't always used, and not all character sets are required …

Member Avatar for Narue
0
93
Member Avatar for Layla_2401

Don't play around with casting like that unless you know what you're doing. Type punning can be tricky business, but barring transmission issues with your sockets, this should work: [code] #include <cstring> #include <iostream> using namespace std; int main() { int i1 = 12345; char buffer[sizeof ( int )]; memcpy …

Member Avatar for Narue
0
188
Member Avatar for amen

>can i use strtok to token the string Not without first copying the string to an array. The c_str member function gives you a pointer to const char, and strtok modifies the string you pass to it. To do it right, you would end up with something like this: [code]char …

Member Avatar for Narue
0
150
Member Avatar for degamer106

>Any help you guys can offer would be helpful. My first bit of help would be to tell you to use code tags, not inlinecode tags. >sort them so that the names are in ascending order based on the average "Them" being the 3 numbers for each name or the …

Member Avatar for Narue
0
140
Member Avatar for marioxp

>I'm not too sure about 2d vectors although I guess its inherent structure would probably be the same. [code] std::vector<std::vector<T> > matrix; [/code] std::vector is designed to work the way people expect even in multiple dimensions.

Member Avatar for Narue
0
174

The End.