6,741 Posted Topics
Re: [B]>while (done = false)[/B] That = is not the same as == issue has been coming up a lot recently. Your loop condition is always going to fail because now done is false and that's the result of the expression. | |
Re: At first I was going to post up my own AES code when I had the time, but after the constant bumping with zero-value posts and duplicate threads, I think I'll just let you figure it out on your own. Nice job. | |
Re: You're printing the address of the pointer, not the value of the pointer. cout will interpret [iCODE]cout<< a[/iCODE] as a C-style string though, so you need to cast it to void* to get the correct value: [code] cout<< (void*)a <<endl; [/code] | |
Re: Try it and see. Include leading whitespace in your input string. p.s. Come up with better thread titles. I very nearly reported this thread as a duplicate, and I'll refuse to help for future questions titled "need help with Dev C++". | |
Re: If you want to use exceptions, the code must generally be written with them in mind from the start. Tossing exceptions in as an afterthought has never ended well, in my experience. | |
Re: You need to clarify the algorithm first. Are count and x the same entity? Because if not, you need to specify what the starting value for x is and update count in the loop or it will run infinitely. Is the else clause tied to your while loop such that … | |
Re: You already have a thread on this. Why start another? | |
Re: imgSet is a 2D array, dude. [iCODE]printf("%c ",imgSet[i])[/iCODE] isn't doing what you think it's doing. | |
Re: AES is popular on this forum right now... As for your issue, you realize that the difference between hexadecimal and decimal is superficial, right? The underlying value is the same, so your problem is imaginary. Can you elaborate on exactly what isn't working as expected when you "input" your own … | |
Re: [QUOTE]to avoid it i want to develop on software with few updates[/QUOTE] The updates you speak of are definitions of newly discovered viruses and occasionally software improvements. When writing reactive software, there's really no avoiding regular updates for something as constantly evolving as viruses. If you're thinking of a strictly … | |
Re: [B]>The serial number of motherboard must be obtained. >How to do it under Windows ?[/B] [URL="http://technet.microsoft.com/en-us/library/ee692772.aspx"]WMI FAQ[/URL]. | |
Re: Help comes to those who first help themselves. In other words, what have you done so far? | |
Re: [QUOTE]I believe that is wrong.[/QUOTE] Actually, it's correct. A POD type (either using the class or struct keyword) is one of the situations where the compiler doesn't need to synthesize a constructor, and compilers will generally not do so for performance reasons. Though it's a bit of a leap to … | |
Re: Try using perror to see if you can get a more informative error message. | |
Re: "%7s" instead of "%s". The field width will limit how many characters scanf reads and places into the array. Or better yet, use fgets for string input. | |
Re: Do you have a handle on C++ fundamentals as well as the primary algorithms and data structures? If not, you'd best focus on those things for a bit. Once you get into real world development, strong fundamentals will be your biggest asset. And if you jump in too soon, you'll … | |
Re: [B]>middleName.length[/B] Length is a member function, not a data member. I'd also recommend using size() instead of length(), since length() is specific to the string class while size() is used in the standard container libraries. | |
Re: It looks like you want an object: [code] struct functions { int AND_function ( int lhs, int rhs ) { // ... } }; int main() { functions fun; fun.AND_function( 5, 10 ); } [/code] What exactly are you trying to do? | |
Re: Dare I ask what you've been doing to improve quality? | |
| |
Re: [QUOTE=VernonDozier;1484287]>> since your first operand of || was true, it skipped the foo() call in the first example. That part I understand and expected. However, I expected the second part to also output 0. From the link, I see that both "left to right evaluation" and "short-circuiting" are mandated (thanks … | |
Re: [QUOTE]I'll just get to the point.[/QUOTE] That's certainly better than the alternative. [QUOTE]I want to write objects of type B to a file in binary form using fstream and it's 'write' member function.[/QUOTE] That would be unwise. B is not a POD type, which wreaks all kinds of havok when … | |
Re: [QUOTE]But my doubt is that if a linked list has a loop, then wouldn't it be a circular linked list?[/QUOTE] Not necessarily. This is a circular linked list: [CODE=text] a -> b -> c -> d -+ ^ | | | +-----------------+ [/CODE] This is a list with a loop, … | |
Re: [iCODE]argv[argc][/iCODE] is a null pointer. Your loop runs too far by one. | |
Re: [QUOTE]Standard is flawless.[/QUOTE] Even when it's wrong. The C standard has had contradictory clauses in the past. Imagine the confusion that ensued. ;) | |
Re: [B]>if(insertedPlayer < current)[/B] You're comparing pointers, not the "id" data member. | |
Re: You have a dictionary of words somewhere, right? My first attack would be to put the dictionary into a trie, with a special search that returns the end of the first complete match from the end of the most recent match. For example given a very limited dictionary: [code] #include … | |
Re: You wrote past the end (or beginning) of your dynamic memory and corrupted any bookkeeping data required by the heap manager. | |
Re: [QUOTE]this is not my homework..i only want to get advance for my study in c++.[/QUOTE] I fail to see how it not being homework somehow exempts you from making an honest attempt. | |
Re: Before looking for ways to do this, maybe you should consider why you want to do it in the first place. Bitwise operations not working on floating-point isn't much of an issue because most of the time it's nonsensical. | |
Re: The third argument is valid (it's just a c-style string), but the fourth argument is incorrect. name.size() or name.size()+1 is likely what you intended. | |
Re: cout is smart about types. If you try to print a char, it will be interpreted as a character rather than a small integer. If you copy that value into an int object and print [i]that[/i] cout will no longer interpret it as a character. You're seeing the integer value … | |
Re: Instead of worker.abort(), use this: [code] keybd_event(VK_RETURN, 0x3d, 0, 0); keybd_event(VK_RETURN, 0x3d, KEYEVENTF_KEYUP, 0); worker.join(); [/code] The problem was that stdin was locked by getch, and terminating the thread didn't release the lock. The simplest solution I can think of is signaling a keyboard event to unlock stdin and stop … | |
Re: >Is it possible to create programmes to run on coumputers thad do not have any operating systems? No, since to do so would require you to write an operating system to some extent. | |
Re: I don't understand the question. What do you mean by "plain text substitution"? | |
Re: It sounds like your hard drive has died. The computer can't find a boot sector and is asking for one. | |
| |
Re: Try creating a new thread for accepting input and manage the timeout in your main: [code] #include <windows.h> namespace jsw { namespace threading { class auto_event { public: auto_event(): _event(CreateEvent(0, false, false, 0)) {} BOOL wait(DWORD timeout = 1) const { return WaitForSingleObject(_event, timeout) == WAIT_OBJECT_0; } BOOL set() { … | |
Re: What's the ultimate goal here? Are you just trying to report the uptime of a process, or is this more of a control to keep the process from running continuously for a certain amount of time? | |
Re: fgets includes the trailing newline, so when the user types "pwd", the resulting string is actually "pwd\n". Try removing the newline after your fgets: [code] if (fgets(text, sizeof text, stdin) != NULL) text[strcspn(text, "\n")] = '\0'; [/code] | |
Re: [QUOTE=Lerner]I'd separate the original array into two separate arrays, one for evens and one for odds. Then I'd loop through the arrays printing evens and odds with the same array index on the same line. If there was more even than odd or visa versa, then I'd print an empty … | |
Re: I want to know when you'll use this knowledge anywhere except in a class taught by an idiot. Yes, there are other answers, but they follow the same concept. And your code is only correct with the condition that the compiler supports a void return from main. Otherwise it invokes … | |
Re: [QUOTE]It was here that I was told that I was shown that, and it doesn't give any errors at all.[/QUOTE] Most likely your compiler is being helpful and ignoring the typedef keyword. Turn up your warning level and you'll probably see some mention of it. This is the correct syntax: … | |
Re: That's not a tutorial, it's a reference. References only tell you what's available, not how to use it (except perhaps with a small example). I'm not aware of any good full tutorials on string handling in C++, but I don't doubt that there are many to be found from a … | |
Re: Thanks for those kind words. :) To answer your question, I prefer Visual Studio with the Comeau front end and Dinkumware standard library implementation. Though that doesn't stop me from using several compilers on a regular basis. It's a habit I got into for maximum portability. | |
Re: Which array class? Standard C++ does not define such a class, though the TR1 extensions (which are blessed in C++0x) do provide a fixed array class. Without knowing the library you're using, it's hard to make a suggestion. Though honestly, an array class is easy to write. And the only … | |
![]() | Re: How do you know str ends with '\0'? Unless you placed on there explicitly, the error is correct and you're walking off the end of the string. |
The End.