6,741 Posted Topics
Re: >i have to give the programme back to my teacher in few mins Too bad, so sad. We're not responsible for your laziness. | |
Re: >Looking at the error i get with g++ would mean that there >is no open method that takes a wchar_t* as parameter g++ is correct. The C++ standard doesn't define an open member function that takes const wchar_t* as a filename type. >but then, why the heck does it compile … | |
Re: In other words, you have nothing. Give it a try first, then we'll be more inclined to help you. | |
Re: >what is the opposite for the virus? What is a virus? It's basically a program that propagates itself, "infecting" the target computer. The opposite of a virus would be any program that doesn't multiply on its own at all. You might also define a virus as a self-multiplying program that … | |
Re: >Any reason why this wouldn't fix it? I add warning 4996 to my "I don't give a crap" list in the project settings[1]. You can also disable it directly in the code using a pragma: [code=cplusplus] #pragma warning(disable:4996) [/code] [1] Assuming you're using Visual Studio, of course. ;) | |
Re: Let's start with two simple rules: You can't nest function definitions, and you can't have two identifiers in the same scope with the same name. So move the definition of memcof outside of main and stop reusing names like data, n, m, xms, and d. Finally, memcof steps on the … | |
Re: >The List class contains all the linked list information This sounds like ListNode is a nested class. Most likely the problem is you're not properly qualifying the type: [code=cplusplus] List::ListNode cur = new List::ListNode; cur = head; cur = cur->next; [/code] | |
Re: >this field may/may not be empty strtok ignores empty fields, so if that field is empty, you're actually processing a null pointer because there are fewer fields than you're expecting. If you want to get an empty string for the empty field, don't use strtok. | |
Re: >i have attached the directions for our assignment and what the output is supposed to look like No, you haven't. But that's okay because I'd tell you that very few of us are willing to open attachments and that you'd have better luck if you just copy/pasted the details in … | |
Re: >please keep it as simple as possible [code=cplusplus] client a, b, c; a.setStats(); b.setStats(); c.setStats(); [/code] Of course, this is assuming your client class wasn't broken, which it is. But since people tend to rail on me for answering questions that weren't asked, I won't go into detail. | |
Re: >can u tell me y linker gives error when we try to define a variable >in a header file and include this in more than one source file? C allows you to declare a variable any number of times, but you can only define it once. If you place a … | |
Re: >what are these constants Why don't you ask the person who created the formula? >why m-1, yy-1 etc.. I imagine because m and yy are 1 based, and the formula works better with values that are 0 based. | |
Re: >char fname[100][50]; That should be 51 if you're allowing 50 content characters. You need to make room for the null character at the end. | |
Re: >You cannot print the whole array in one action. Sure you can: [code=cplusplus] #include <algorithm> #include <cstddef> #include <iostream> #include <iterator> template <typename T, std::size_t N> T *end ( T (&array)[N] ) { return array + N; } int main() { int a[] = {1,2,3,4,5,6,7,8,9,0}; copy ( a, end ( … | |
Re: >I wonder what are they do in there? Much like the real Area 51, ours is rather anti-climactic. ;) | |
Re: You don't need any math procedure (assuming you mean a library function) as this task involves no more than is simple arithmetic: [code=vbnet] Do While pennies >= 5 If pennies >= 100 Then dollars += 1 pennies -= 100 Else If pennies >= 25 Then quarters += 1 pennies -= … | |
Re: >I am having trouble understanding what a successor is. A successor is the node with the next highest value. [code] 6 3 8 2 5 7 9 4 [/code] In this tree, the successor of each node is the next node that would be given in an inorder traversal. For … | |
Re: >Compile and run it, then do it again with the line //in(buffer,b); uncommented. It breaks inside if the in function on this line: [code=c] current[x]=b[i+x]; [/code] And it does this because strlen(a)-strlen(b) in your outer loop condition results in a negative number, yet you increment i from 0. | |
Re: >so what say now?? You got lucky. Just because it doesn't crash when you run it this time doesn't mean it won't crash next time, or when you're demoing your program for a client. Undefined behavior is like that. | |
Re: >Please don't blame that code on me! :) I didn't write it. Heheh, gotta love being attributed for bad code. ;) >Second question is how can I write hexadecimal numbers? can c recognize hexe?? C can read and write hexadecimal. Since it's a formatted value, you need to use the … | |
Re: I'm moving this from the necrothread you bumped from 2006 to its own thread so that you can be properly hazed by the regulars. | |
Re: IIRC, there's a SelectionChangeCommitted event in the ComboBox class. Subscribe to that event and run your code inside the event handler. | |
Re: Well, to begin with, you're reading a leading character from the file. If that leading character is actually part of one of the numbers you want to read, you've corrupted your input stream by changing the starting offsets of each read. Further, the variable you're using to read numbers is … | |
Re: >It seems very distracting to have a thousand lines of code all in the same file Modern IDEs make it very simple to deal with this, provided the thousand lines are all relevant to the file. >Is there a good way to kind of group functions together into separate >files … | |
Re: >What is the relationship between inheritance and composition Inheritance is a special case of composition. >why the two can be used in place of other They solve the same problem and they're equally functional. If you're willing to suffer notational and structural inconveniences, inheritance can always be used in place … | |
Re: Hmm, let me see if I understand what you're doing. Is it taking a single linked list and splitting it into an array of linked lists based on a certain criteria? [code=c] #include <stdio.h> #include <stdlib.h> struct node { int data; struct node *next; }; struct node *push_front ( struct … | |
Re: 1) The following compiles as C++, but not in C: [code=cplusplus] #include <stdio.h> int main ( void ) { int a = 0; int b = 0; (a, b) = 10; return 0; } [/code] 2) The short answer is that an enum constant in C is an integer type, … | |
Re: >Is there any specific advantage of using int main() over void main() There is indeed. int main() is always correct, void main() is not. | |
Re: As darkagn has already said, we're not a homework service. We're a resource for education. Much like your teacher isn't going to do your homework for you, the same goes for us because that defeats the purpose of this forum. However, I [i]will[/i] link you to a [url=http://eternallyconfuzzled.com/tuts/algorithms/jsw_tut_sorting.aspx]sorting tutorial[/url] with … | |
Re: You're over-engineering the solution. It's really nothing more than this: [code] print ' ' print n '*' for i = 0 to n do print n + 2 '*' loop print ' ' print n '*' [/code] | |
Re: >fscanf(filename, "%d", t[i]); >fscanf(filename, "%c", dump); Don't forget that scanf expects a pointer. If your variable isn't already a pointer, you need to prefix it with the address-of operator: [code=c] fscanf(filename, "%d", &t[i]); fscanf(filename, "%c", &dump); [/code] | |
Re: It's generally considered rude to post your code and say "please help". Such a request is far too vague. Perhaps you could ask a specific question or describe exactly what you're having trouble with. | |
Re: IIRC, the event handlers will give you an EventArgs object that has this information. | |
Re: >How many types of sorting are there in c? Hundreds with names, thousands more without names. >give code for all of them Haha, no. Do your own work. | |
Re: I'm not sure I understand what you want. I'll guess, probably be wrong, and then ask you to describe the problem in a different way. So here's my guess: [code=cplusplus] #include <iostream> #include <stdexcept> class Foo { int _a; int _b; int _c; public: Foo ( int a, int b, … | |
Re: Simple solution: Make the center line a special case outside of the loops and change the condition of the loops to be < 10 rather than <= 10: [code=cplusplus] #include <iostream> #include <iomanip> using namespace std; void main() { int space = 2; int counter = 19; int count = … | |
Re: It seems to work fine for me. Can you be more specific about how it's not working properly? Perhaps also tell us what the type of your pattern variable is? | |
Re: >Do you see anything wrong with this Yes, I do. Clearly you haven't compiled or run this code, otherwise you would see something wrong as well. I suggest you do that. | |
Re: I don't see you writing to DataFile3 in that snippet. | |
Re: Off the top of my head, I don't think there's a way to do that without some kind of presentation trick that hides the changes in progress until they're finished. | |
Re: >I am contemplating moving from c# to VB Ideally you should learn them both. The actual languages aren't overly complicated, it's the .NET framework that has a huge learning curve. So if you already know the framework, you should have the more common .NET languages in your repertoire. >if I … | |
Re: Call srand at the beginning of your program, not each time you call rand. You keep reseeding the random number generator, and because your program is running fast enough, the seed is always the same. This will result in the same "random" number every time. | |
Re: I'm guessing that you're looking for "walker" (or rather, "walke" going by your code) and highlighting the entire string regardless of whether the search string is a substring or the whole line. | |
Re: My first question is why are you using an array of 1? There's no benefit to using an array if it only has one element. >How do i assign my integer value to the above variable? Presumably you're asking how do you convert an integer into a string. Here's an … | |
Re: You're missing a comma between the address and handphone arguments in your call. | |
| |
Re: >Can anyone here shed some light on it? Gladly. The problem is that you're expecting a well defined order of evaluation where none exists. The language standard says that between sequence points, the compiler can evaluate the expression in any way it likes as long as the result is correct … | |
Re: I can think of two simple solutions off the top of my head: 1) Allocate an array of N, where N is the number of nodes in the tree. Then traverse the tree and save the level of each node in the array as you go. Sort the array and … | |
Re: You're mixing up two different solutions for calculating a factorial. Just remove all of the manual stuff and use the function: [code=cplusplus] #include<iostream> using namespace std; int factorial(int); int main() { int x; cout << "Enter a number to see factorials for: "; cin >> x; cout << "\n"; for … | |
Re: Barring the bad idea of using goto where a loop construct is better suited, what have you tried? Generally we expect you to post code to prove that you've made an honest attempt before we'll help. |
The End.