- Strength to Increase Rep
- +9
- Strength to Decrease Rep
- -2
- Upvotes Received
- 73
- Posts with Upvotes
- 62
- Upvoting Members
- 38
- Downvotes Received
- 12
- Posts with Downvotes
- 12
- Downvoting Members
- 3
278 Posted Topics
Re: I'm not really sure if I understand your problem, because as far as I can see you are already have all of the knowledge to solve it. Your question is how to pass the two matrices to the thread that is going to multiply them. And you say that you … | |
Re: Takes about a 2 second Google search... probably less: [url]http://www.yolinux.com/TUTORIALS/LinuxTutorialPosixThreads.html[/url] [url]http://www.boost.org/doc/libs/1_45_0/doc/html/thread.html[/url] | |
Re: webhost.com won't allow you to connect to the MYSQL database remotely. Try to ping the domain: C:\Users\thelamb>ping mysql9.000webhost.com Pinging mysql9.000webhost.com [10.0.0.23] with 32 bytes of data: 10.0.0.23 is the local ip on 000webhost.com where they run the mysql server. | |
Re: [code]if(data[j] == ayat)[/code] This comparison will only work if the user enters the exact string that is in the data array. This is not what the question asks, you need to come up with a way to compare parts of(the entire student ID, or part of the student name) the … | |
Re: i is generally used for loop counters.. but no one is forcing you. Specially if the body (the part between { and }) of the for loop is big, you might consider using a more meaningful name for the loop counter. There are a lot of 'naming conventions'.. each with … | |
Re: There is nothing wrong with this snippet (but yes, use dynamic_cast). Maybe you set the breakpoint wrong, You're saying something with a DLL and an EXE, so if the code of Main() is in the DLL, how did you set the breakpoint? You can try instead to show a MessageBox. | |
Re: How about instead we help you solve what is wrong with this code. Now, to do that.. we need to know what you mean with 'doesn't work when called'. This sentence alone is not very helpful: Does it crash? Does it just it give output, but not what you expect? … | |
Re: Naturally, you can have multiple connections to one port. Just think of an HTTP web server serving web pages to thousands of users connected on port 80. The way you distinguish between clients is by socket number. Now, you falsely assume that every time accept (or any WinSock functions) returns … | |
Re: When you return from main, your program is terminated, this also means that the console window will close. In Visual studio, if you execute your program by pressing 'Ctrl + F5' it will not immediately close, instead it will wait for you to press a key. In other situations, you … | |
Re: And now we have to guess what the problem is, right? Why don't you help us out and tell us what you're having problems with, ok? Makes things a lot easier for the people willing to spend time trying to help you. | |
![]() | Re: Your question is impossible to answer. How am I suppose to give a value to how difficult it will be for you? All I know, from my own experience, is that for me it is easiest to learn a language by just starting to write a project in it. This … |
Re: [code=cpp] char* a[10]={"asd","QWE","ghj"} [/code] On this line, you are assigning const char* (everything between "'s) to a char* (elements of a). So when you try to modify something at a[1][1] you are trying to modify a const char* indirectly. Because this constant data ("asd", "QWE", etc.) is stored in a … | |
Re: There is a big OS development community here: [url]http://forum.osdev.org/index.php[/url] with a wiki: [url]http://wiki.osdev.org/Main_Page[/url] Usually, hobby-OS projects are compiled with a GCC cross compiler. There is a document on the OSDev WIKI about how to set this up. In early stages, the kernel can not depend on anything from from libc … | |
Re: You can use (win)pcap to gather network data... it's probably a bit over-kill for your solution though. If you're doing this on Linux, why not make use of /dev/random? On Windows, why not use 'CryptGenRandom()'? If you somehow don't want this, I think easier randomness can be obtained from mouse … | |
Re: When you pass an array to a function, information about its size is lost (unless the function only takes arrays of a certain size, e.g. void foo( string arr[100] ); instead of void foo( string* arr ) or void foo string[] arr) ). Since this is a C++ forum, you're … | |
Re: _TCHAR is typedef'd as 'char' when your project uses 'ANSI' settings, it is typedef'd as 'WCHAR' when your project is unicode. wprintf is just like printf, but instead it takes a const WCHAR* as input, not a const char*. L before a string literal ("string") tells the compiler that this … | |
Re: Yes there is, e.g. in the 'singleton' pattern. Or when you have a global static class that holds objects that should be modifiable. Usually though, you are right that you don't want to do this. But returning a const& is very common, for example in getter functions. | |
Re: And now what? What is your question? Please don't say "it doesn't work". | |
Re: I'm not going to read your code, it is messy. In general, say you have two singly linked lists p and q. To link them together, you can simply make the last element in p point to the first element of q. In pseudocode: [code=cpp] LinkedList p,q; // traverse to … | |
Re: The problem is in these lines: [code=cpp] Point start, end; Point(double x, double y) { this->x = x; this->y = y; } [/code] Your Point class has one constructor, that takes two arguments. However, no where in the Ray class you tell it what the arguments should be. So the … | |
Re: I'm not sure if this is what you mean, if not, can you give an example what you're confused about? [code=cpp] struct base { virtual void test() {} }; struct derived : public base { void test() { } virtual void test2() { } }; int main() { derived* d … | |
Re: I suppose that is a debug assertion you're getting? You should also mention on which line (and don't put spaces in the code tag). Usually it means that you're accessing some_vector[size], but since the vector is indexed from [0...size-1] this is out of range. Without proper code tags your code … | |
Re: How about: [code=cpp] bar = foo[3]; [/code] ? | |
Re: Your comments are a bit excessive, I know this is something very personal but generally you'll want to have few comments that help understand the code, not comments that repeat what the code says. Don't take this too harshly though, I am really a comment-minimalist. E.g. [code] #include <iostream> // … | |
Re: Run the code under a debugger, then tell us on which line it segfault. If you run windows, you can use Visual Studio or whichever IDE you use. You can't really expect people to invest time into reading your code (or copy/pasting + compiling themselves), when you can easily pinpoint … | |
Re: You can add some 'type' variable to the base class, that you set through its constructor. [code=cpp] class base { enType type_; public: base( enType type ) : type_( type ) {} enType getType() const { return type_; } }; struct derive : public base derive() : base( TYPE_DERIVE_1 ) … | |
Re: If I remember right, partial template specialization is in the C++0x standard. I don't know if you can do it on one member function like you want though. Haven't looked into it yet as afaik it's not implemented yet in VS. Also, the enable_if stuff Mike mentioned is in C++0x, … | |
Re: Because 0+2+4+6+8+10+12+14+16+18+20 = 110? What do you think the output should be. | |
Re: Because what you're passing on line A is not a pointer to nVal, it is a pointer with value 65, and you are printing the value of the pointer. On line B you pass the address of nVal, so a pointer with value 2359119. So in the first case you … | |
Re: C++ programming language is more a reference book (at least that is how I use it). I don't know the first two books you read, but if they gave you a good basic understanding of C++ then I would try to start a project. This is the best way of … | |
Re: It is compiler dependent, and you should not need to worry about it. In fact, my output is : [code] 3740816 3740872 3740928 3740984 3741040 3741096 3741152 3741208 3741264 3741320 [/code] new can allocate memory anywhere on the heap, there is nothing that says that two consecutive calls to new … | |
Re: Some comments... Do you understand now why you need the extern keyword? Your use of include guards is a little over-the-top. Placing the #ifndef ... around #include statements normally results in faster compilation, but in my opinion it is way too messy if projects get bigger. Generally, if you use … | |
Re: You're compiling the code with unicode support. If you look at how szExeFile is declared, you'll see: [code]TCHAR szExeFile[MAX_PATH];[/code] Because you compile with unicode support, the compiler expands 'TCHAR' to 'WCHAR', which is a wide character. So in your project settings, you should compile with 'multi-byte support', or change procname … | |
Re: [code] if (determinant = 'E') [/code] This will _always_ be true, note that in C/C++ if you want to compare two values you should use '==', not '='. I'd suggest to write the if statements like this: [code] if( 'E' == determinant ) [/code] That way, if you accidentally write … | |
Re: Your StateList is defined as vector<int>::iterator. StatesPicked is vector<std::string>. So StatesPicked.begin() will return a vector<std::string>::iterator, not vector<int>::iterator. Also, why do you do StatesPicked.begin() + N ? N is 0 so what would be the effect? If you're able to use C++0x features, you can write the code like this: [code] … | |
Re: Is it a pile of .c, .cpp and .h files? If so, try to add those to a C::B project and set the additional include paths to the same folder. Then try to compile and see how many errors it spits at you. You can mess around with the object … | |
Re: You can just give 2 (or more) template 'variables': [code] template< typename A, typename B > class TwoTypes { A a_; B b_; }; And use it like: TwoTypes<int, char> [/code] | |
Re: Did you clean and rebuild the project? If so, can you paste the code surrounding the error? | |
Re: I've only glanced over your code, this caught my eye: [code] case 1: Fmonth = 'January'; [/code] What compiler are you using? This line should generate an error among the lines of "too many characters in constant". I don't know if this is the cause of your problem, as it … | |
Re: You can create an std::map, that maps the strings to integral values. Then call map::find and use the returned iterator to retrieve the key and use that in the switch switch statement. | |
Re: Read this: [url]http://www.daniweb.com/forums/thread90228.html[/url] | |
Re: [QUOTE]Dude, you're a hoot. I officially invite you to Daniweb's IRC channel so that you can entertain us in realtime chat.[/QUOTE] Well, this thread has had one use... I didn't know there was a DaniWeb IRC! | |
Re: "locks up a lot when downloading certain pages" That's not a very good description of your problem... can you be more specific? Does it freeze completely? If so, does it every time if you try page X? Did you run under a debugger to see where it is freezing? etc. | |
Re: To your first question: cin by default 'splits' on the space character. So say: [code] string test; cin >> test; [/code] If the user enters "one two", test will be equal to "one". [EDIT] My original 'easy' way was plain dirty as thankfully pointed out by mike_2000_17, use his solution … | |
Re: 1.3 times as long doesn't seem very significant, how long does the 'fastest' algorithm take? How many times did you run both algorithms. Can you show us the exact difference in code between both approaches, your explanation is a little unclear to me. | |
Re: How will treating the / as whitespace help you? I assume that you want to convert the user's input (e.g. 3/4) to a float (0.75) in your code? So you'll have to split the input string on the '/' character (and do something sensible if the '/' is not found), … | |
Re: Easy to test? Create two threads that run a function with a static variable, print the value of the variable and then increment it. Make sure the first thread is finished before starting the second. | |
Re: Uhm, what about removing the while( true ) on line 68 ?? | |
Re: I don't think it's possible to give a good answer to that question. It will depend on the person reading your resume whether it's good or bad. In my eyes, it shows initiative and the ability to set something up from nothing. Also, if there are more people working on … | |
Re: break is the right way.. but keep in mind that you can only break from 1 loop. [code=cpp] for( int i = 0; ...; ...) { for( int j = 0; ...; ... ) { if( something ) break; // You don't need to explicitly continue here, since it is … |
The End.