3,183 Posted Topics
![]() | Re: Hover over an arrow to add a comment and reputation. Click the arrow just to vote. The arrow you click on or hover over determines if it's positive or negative. Aside from making a dummy dialog (which would ultimately be less user friendly as popups usually are) instead of splitting … |
Re: > how can i make a program that will input a number and convert it into a word using array , and also not using string.h library? Technically you don't need either arrays or the string.h library to do this, though if you're accepting the word as a string it's … | |
Re: Are you limited to a square matrix, or does the program need to support any MxN matrix size? The former is simple enough because the columns and rows match. The latter can be done with dynamic memory (the more general but harder option) or a "large enough" 2D array where … | |
Re: It's basically a combination of how the X shoots and how the Y moves. You add a case to the switch for your shoot key to create a projectile, and then follow a similar algorithm as the bomb to manage the projectile. | |
Re: > Why don't you try using FireFox. Its fast and sleek. Patient: "Doctor, it hurts when I blink." Doctor: "Don't blink." | |
Re: > Can someone please explain step by step on how I would figure this out. http://www.cs.duke.edu/~ola/ap/recurrence.html > "If" would be a simple n It would be constant since the running time doesn't grow with N in any way. | |
Re: dx9_programmer's answer is good, but I'd like to add just a couple of things. First, don't call strlen() in the condition of a loop because it's inherently inefficient. strlen() is a function that itself contains a loop, so when you say this: for (int i = 0; i < strlen(word); … | |
Re: > According to me you should go for Linked Lists as suggested by Ancient Dragon. Its a good solution. Wouldn't that be according to Ancient Dragon then? ;) | |
Re: > atleasy one must reply. Why? Replying to threads is strictly voluntary. Just because you *really* want an answer doesn't obligate anyone to provide one. | |
Re: As the data doubles, how does the time used scale? That's your complexity. | |
Re: The problem is that TSTR can be either `char` or `wchar_t`, so there's not really much choice beyond allocating an array of TCHAR and copying one into the other with a function that recognizes TCHAR and handles it accordingly: TCHAR *ttemp = new TCHAR[strlen(temp) + 1] _tcscpy(ttemp, temp); | |
Re: Here's a better example, see if it helps: #include <stdio.h> #include <stdlib.h> struct node { int data; struct node *next; }; int main(void) { struct node *head = NULL, *temp; int data; printf("Enter a number (0 to stop): "); fflush(stdout); while (scanf("%d", &data) == 1 && data != 0) { … | |
Re: > I'm just not sure how to see if they are equivalent based on the renumbering part.... If one number is shifted by a certain amount, all numbers will be shifted by the same amount. So when comparing the two arrays you can determine the shift amount by the very … | |
Re: > What's up with that? Obviously Daniweb is so awesome that Microsoft decided to emulate us. :) | |
Re: > hm... tried that combonation and it didn't work. And how are you testing for a correct answer? | |
Re: > I thought those places were real! Technically, nothing you use in programming exists because it's just text. ;) Even assemblers take a *text* file of assembly language which is then converted by an assembler into machine code. | |
Re: `short` is a smaller integer type than int (conceptually, at least). The 0xAB00 part is a hexadecimal literal value with the bit pattern 1010101100000000. It's just another way of writing the decimal value 43776 that makes the bit pattern a little easier to see, assuming you're familiar with hexadecimal. ;) … | |
Re: > when there are no comments even then i cant delete it? No. You can report it with the "Flag Bad Post" link and a reason stating why you want it deleted. Then a moderator will determine if the reason is...well, reasonable. But posts are typically only deleted based on … | |
Re: > i dont get any output for case1 (ie char2shrt()) and case2 (ie int2shrt()).. any ideas on that? 'h' is a modifier to the %d specifier, you need them both: "%hd" > i do get an output for case 3 (ie shrt2int()), but have to work out in binary if … | |
Re: > if im doing a dll in dev c++ ..... > and doing a dll in c++ but using visual studio 2010 > > is both of them gonna be the same?? The two DLLs will be compatible, yes. So you can create a DLL with one compiler and load … | |
Re: > I need to bring an example of overwritten. Then you need to explain what you mean by "overwritten" more clearly. Because the way you've described it so far, an example that actually compiles is impossible. | |
Re: That's weird. It's almost as if our code highlighter is interpreting tags with no content as empty tags. At least for that particular malformed situation (an extra closing tag that was probably added automatically by a "helpful" editor): <tag></tag> stuff stuff </tag> | |
Re: Simultaneous processing can be done with threading, but that's a can of worms that I don't recommend opening unless you absolutely must. A way to fake it in a single threaded application would be to specify a distance threshold between the two keypresses that denotes "at the same time", and … | |
Re: FYI: Dani and I typically use Area 51 for testing stuff in production so as to avoid cluttering the publicly viewable forums with such things. | |
Re: Let's say `i` is 6. You're trying to take the factorial of `(2 * 6 + 1)`, or 13. 13! is 6227020800, which overflows even an unsigned 32-bit integer (your range is roughly halved from that by using a signed type). It's not unexpected that you'll start getting funky values … | |
Re: > can anyone tell me if there is such thing as 64 bit assembly Yes. > if so can you give me an assembler MASM, NASM, and FASM all support 64-bit instruction sets. | |
Re: How are you creating the child process? The answer to this question depends on your OS and compiler because managing processes is highly dependent on the system. | |
Re: > What is the OP's question ? The OP's question was clearly "d". Can't you read? ;) Now we need to figure out what the question means and answer it. :rolleyes: | |
Re: When working out these problems, start by understanding what the *expected* result should be, then trace through your code in a debugger and find the place where the expected result differs from the actual result. That's where your logic error is likely to be. Obviously this process can be difficult … | |
Re: > where is union required? A union is never *required*, but it can simplify certain tasks such as type punning. An example is from the C standard library implementation in my signature. I use a union for punning between an IEEE double, its 64-bit representation, and a breakdown of the … | |
Re: You would do well with some error handling, as I suspect the file isn't being opened and span remains uninitialized: #include <cstdlib> #include <fstream> #include <iostream> #include <string> using namespace std; int main() { string filename; cout << "Enter a file path: "; getline(cin, filename); ifstream in(filename.c_str()); if (!in) perror("Error … | |
Re: I only glanced over your post, but I'm 99.9% sure that it's the classic stream garbage problem when mixing formatted and unformatted input. You see scanf() is special in that most of the time it will discard leading whitespace from the stream and *leave* trailing whitespace. gets() on the other … | |
Re: It might be just you, I haven't seen that issue at all. At least not with Chrome, what browser are you using to test with? | |
Re: This thread was marked as solved. Did you solve your own problem? On a side note, is it really so hard to type "input"? I mean, it's got to be less awkward to type and is only two keystrokes longer. | |
Re: First you have this: #define radius Then this: cout<<"\nRadius is " << radius << set(8)<< "PI is" <<PI; What exactly were you expecting to get printed when radius is replaced with nothing? The end result after preprocessing is this: cout<<"\nRadius is " << << set(8)<< "PI is" <<PI; And that's … | |
Re: > i want to gain full knowlege of programming language.. Um...programming isn't that simple. Not even the creator of a programming language has "full" knowledge of it, because "full" knowledge encompases more than just the trivia of syntax and semantics. Even if you're a book smart pedant who can quote … | |
Re: > My program doesn't have mistakes, because I already solved them. :-D This is the difference between a beginner and someone with experience. You think you've made no mistakes and your program has no bugs. We *know* we've made mistakes and are grateful when someone finds a bug. Drop the … | |
Re: Your situation sounds perfect for going to university. You'll have a better idea of whether you want to do something with computers after taking classes and and if nothing else leave with a degree that will help you get a job. | |
Re: The conio library is nonstandard and thus not supported by all compilers. If you can remove the parts of conio that you use (such as a leading clrscr() or a trailing getch() in your main() function), that's probably the best approach. Otherwise you'll need to look for alternatives or change … | |
Re: > if (c == ' ' || c == '\n' || c = '\t') One of these things is not like the other. Look very closely, I'm sure the book didn't mix up operators. | |
Re: If you have two non-black spots going in different directions from a cell, then that's an intersection: bool is_intersection(char board[M][N], int x, int y) { if (board[x][y] == '#') return false; return (board[x - 1][y] != '#' || board[x + 1][y] != '#') && (board[x][y - 1] != '#' || … | |
Re: > Please shut up if you don't know how to code... Thank you so much for that comment. I might have actually wasted time helping an ungrateful jerk. I really appreciate your concern for everyone's time. Best of luck with your problem. | |
Re: > A program for > >A BC DEF GHIJ KLMNO That's kind of weird, but okay: #include <iostream> using namespace std; int main() { cout << "A\nBC\nDEF\nGHIJ\nKLMNO\n"; } p.s. We're not your coding slaves. Posting your homework without even a please or thank you again will find it deleted. Please … | |
Re: > No this is not a school assignment...just something i thought i'd practice That doesn't remove the onus of making an honest attempt. | |
Re: Please post the compiler errors. | |
Re: > can anyone do me a project on this !! plzz You're joking, right? | |
Re: > For flushing input stream, there is a nice article in daniweb C++ forum. Check this. And the suggested solution is also for C++ only, it won't work in C because there's insufficient framework in the stdio library to support it. |
The End.