6,741 Posted Topics
Re: My family gets together with some good ol' fashioned southern home cooking. There's nothing like binging on awesome food with good company and then not eating for the next day because you're too full. ;) | |
Re: [QUOTE]So whenever a user executes the application on a system where "," is the decimal separator my result is 1.0, only on systems where "." is the decimal separator I get the correct result 1.2345.[/QUOTE] You can change the locale temporarily. I assume your problem is that the string is … | |
Re: [QUOTE]What I came to know from google is that Bit shifting allows for compact storage of similar data as a single integral value.[/QUOTE] It's not just shifting, and that's not the only use of the bitwise operators. Since a byte is the smallest addressable unit in C#, that's typically the … | |
Re: Your algorithm is a little goofy. I think a more intuitive algorithm would match the way one might do it manually: [list=1] [*] Find the first non-vowel and mark it [I]y[/I], this is the end of the vowel half [*] Find the next vowel and mark it [I]x[/I] [*] Swap … | |
Re: [QUOTE]I want to be able to display the feedback with words that are bold or different color.[/QUOTE] Update the Font property of your rich text box. | |
Re: The head of the list only needs to be set if the list is presently empty. Your add_student() function always resets the head to the [i]last[/i] node in the list during the else clause. Just cut that line out and all will be well: [code] if (head==NULL) { temp->next=head; head=temp; … | |
Re: It's called [URL="http://en.wikipedia.org/wiki/Type_punning"]type punning[/URL]. By casting the address of an integer into a pointer to char, you can directly access the bytes that make up the integer (note that char is synonymous with a byte). | |
Re: Well, for starters you have some goofiness in your code such as using string as a variable name when it's also a type and trying to call a global function from a member function of the same name without qualification. Here's the main.cpp with those problems fixed because they're a … | |
Re: No code tags, a bunch of code, and no question. Awesome. :icon_rolleyes: | |
Re: Function calls use parentheses, not braces: [code] System.Console.Writeline("this is my program") System.Console.ReadLine() [/code] | |
Re: [QUOTE]i couldn't add and delete and also search...[/QUOTE] I suspect you didn't look very hard, or looked for something complete that you could use without any thinking. But if it's the deletion for AVL trees you're having trouble finding, that's understandable. Most resources leave it as an exercise for the … | |
Re: [QUOTE]For Example, if we enter 12300 then these programs output 1 2 3 only and similarly if we enter 1000 then they only output 1.[/QUOTE] If you have 1000 and cut off the most significant digit then that becomes 000, which is equivalent to 0. This algorithm does not work … | |
Re: [CODE]#include <stdio.h> void foo(int *p) { printf("%p: %d\n", (void*)p, *p); } int main(void) { int i = 12345; int *p = &i; foo(p); return 0; }[/CODE] | |
Re: [QUOTE][CODE]void color(int a,int b)[/CODE][/QUOTE] Two parameters. [QUOTE][CODE]bObj->color(10,20,30);[/CODE][/QUOTE] Three arguments. I see what you wanted to happen, but it won't work because ducati's version of color() is an overload rather than an override. When looking at the object through a pointer to bike, you can only see the public member functions … | |
Re: [QUOTE]scanf() can be used in this case, but it's a lot more work, because of the '.' and filename extension after it.[/QUOTE] Eh? I see no reason why scanf() would be harder for those reasons. The %s specifier uses whitespace as a delimiter: [code] char filename[50]; if (scanf("%49s", filename) == … | |
Re: [QUOTE]what should I do with the vowels? should I set an array for it?[/QUOTE] I've always seen people write a small helper function: [code] #include <ctype.h> int is_vowel(int ch) { ch = tolower((unsigned char)ch); return ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' … | |
Re: [QUOTE]Is it the person who posted the solution or the lurker who made the last (but not helpful) post?[/QUOTE] It's both, to the best of my knowledge. Everyone who posted prior to the thread being marked as solved (except for the OP, of course) will have their solved thread count … | |
Re: An error like [I]what[/I]? Are we to supposed to read your mind to see the error message? | |
Re: [QUOTE]I heard I could do this with multithreading (which apparently is very complicated).[/QUOTE] You heard correctly. While threading is conceptually very simple, the subtle and difficult to trace errors of shared data access makes it among the harder things that most programmers have to deal with. [QUOTE]Is there any other … | |
Re: [QUOTE]What are the best practices about using properties in C#?[/QUOTE] Best practice is really no different from parameters and return values from functions. If you can get away with a reference, do so. It's generally more efficient for both space and execution time. Not to mention that it's easier to … | |
Re: [QUOTE]C should be CONCISE, (short, and to the point), not a Rube Goldberg deluxe creation. Simple and clear are secondary goals to accuracy, but important one's nevertheless.[/QUOTE] Concise and clear can easily be mutually exclusive. For example: [code] #include <stdio.h> #define min(a,b) ((a) < (b) ? (a) : (b)) #define … | |
Re: You can do most of the work in scanf(). For example: [code] fscanf(in, " %*[Zz]%d %[^\n]", &index, buf); fgetc(in); /* Discard the newline (if present) */ [/code] It's not quite as good as a regular expression, but suffices for strict formats. There's also extra work interpreting the values, but all … | |
Re: [QUOTE]i just know how to concatenate two strings but when inserting a character in a string im totally lost .[/QUOTE] Well, think about it as if the characters were boxes lined up. If you want to put a box somewhere in the middle, you need to make room somehow. Usually … | |
Re: I see no provision for negative numbers (or any sign at all). Usually it follows logic similar to this (greatly simplified): [code] if (*s == '-' || *s == '+') { sign = *s++; } /* Convert the number */ if (sign == '-') value = -value; [/code] | |
Re: [QUOTE]can anyone explain to me how this program works.[/QUOTE] Can I? Yes, this program is actually very well known as it was an early winner of the [URL="http://www.ioccc.org/"]IOCCC[/URL]. Will I explain it to you? No, IOCCC programs are written by very clever people, and the techniques implemented are virtually useless … | |
Re: There are multiple ways of doing it, but in my opinion the most instructive is with a level order traversal, since checking for a complete binary tree is a pretty specific operation. By generalizing the problem a bit, you can get more out of the exercise. So here's an updated … | |
Re: The error makes sense. How do you find "" to replace? Are you trying to replace nothing? Every character? It's ambiguous. In the case where the search string is empty, I'd simply do nothing: [code] private void btnReplace_Click(object sender, EventArgs e) { if (txtSearchFor.Text.Length == 0) { txtReplacedWord.Text = txtInputWord.Text.Replace( … | |
Re: [QUOTE]..Someone should have told me that there is an issue with strtok and strcat..[/QUOTE] Since when is not knowing how to use a function an "issue" with the function? That's more like an issue with the programmer. | |
Re: [QUOTE]The following code does not work.[/QUOTE] Obviously. You're trying to print the return value of a function that returns void. [QUOTE]However, if you remove void in front of replace_str, in Code Blocks i am able to run it (WHY???) despite the fact that i still get a warning[/QUOTE] Prior to … | |
Re: The key piece of information is the location of select(): "/usr/include/sys/select.h". This is the POSIX version, which means it's being linked automatically and you need to rename your select() function to avoid conflicting with it. | |
Re: [QUOTE]Is 2n+constant a good big o notation for a sorting algorithm?[/QUOTE] Yes, that's excellent relative to the usual suspects such as quicksort and mergesort, and it hints at the algorithm as well because comparison-based sorting algorithms have a hard bottom of Omega(nlogn). If you've dropped into linear territory your algorithm … | |
Re: [QUOTE]What is Big O notation?[/QUOTE] [URL="http://lmgtfy.com/?q=big+o+notation"]Big O Notation[/URL] [QUOTE]Do you use it?[/QUOTE] Yes. [QUOTE]I missed this university class I guess[/QUOTE] Riiight. :icon_rolleyes: [QUOTE]Does anyone use it and give some real life examples of where they used it?[/QUOTE] In many a code review I've used both time and space complexity with … | |
Re: If it's not random, you need to specify what rules have to be in place for generating each number. For example, is it a sequence number? A number based on the date and time? "Not random" is not helpful; the best one can offer is this: [code] // Generate N … | |
Re: [QUOTE=YAMNA MIDHAT;1690285]its no difference in string weather you write & or not in string because the string name saves the address it self. ;)[/QUOTE] Actually, there's a subtle but significant difference. The address may be the same, but the [i]type[/i] is different. If you pass an object of a different … | |
Re: Please confirm which name you wish to use, I can only give you one. :icon_rolleyes: | |
Re: Try CStr() instead of Convert(): [code] string query = "select CStr(Fault_Time),[Level],[Trouble_Source],[Solution]," + "[Ticket_Status],[Close_Date],CStr(Close_Time),[Actual_Cause],[Solution]," + "[Description] from [TT_Record$]"; cmd = new OleDbCommand(query, conn); [/code] | |
Re: [QUOTE]Maybe he doesn't know the code so he did the easiest thing to increase his posting.[/QUOTE] I strongly doubt it. Walt is one of the better programmers on this forum. [QUOTE]Anyways here's the code.[/QUOTE] And it doesn't solve the stated problem. But on the plus side, I can't scold you … | |
Re: [QUOTE=jean122;1694145]the game is from torrent, there's no patch available. So I used the cd key from skidrow. should I wait for a patch?? greetings jeannot[/QUOTE] Discussion of cracking is not allowed on Daniweb, nor can we in good conscience help with cracked software. Thread closed. | |
Re: How in the world can you destroy all formatting when you're obviously using Visual Studio to write the code in the first place? | |
Re: [QUOTE]for some reason I keep getting a segmentation fault[/QUOTE] The reason is nearly always an out of range index. Verify that any indices you use are between 0 and n. | |
Re: Let's start with the conceptually simpler one. [ICODE]var[/ICODE] is something of a placeholder that says "deduce the type for me". Since the compiler already knows the type on the right hand side of an initialization, why should you be forced to specify it explicitly on the left hand side? Prior … | |
Re: [QUOTE]The problem is that the FillTime function doesnt calculate correctly.[/QUOTE] Because you're passing it garbage. Rather than just give you the solution, I'll point you toward the root of the problem, which is a misunderstanding of pass by value vs. pass by reference. | |
Re: That question is very clear. You're to write a function that converts enumeration values into their corresponding string (ie. [ICODE]MERCURY[/ICODE] into [ICODE]"Mercury"[/ICODE] given [ICODE]enum planets { MERCURY };[/ICODE]) and a driver that tests the function. | |
Re: There's a Text property that supports both getting and setting: [code] s1Textbox->Text = gcnew String(ss.str().c_str()); [/code] | |
Re: C isn't any different from assembly in that there's no magic. The byte representation of an integer isn't going to be meaningful when directly displayed as characters. What *printf() does is convert the value to an string representation along the lines of: [code] /* Very basic, do not use except … | |
Re: [QUOTE]but it doesn't enable the panel even though i use bringtofront(), enabled and visible?[/QUOTE] Then you're not doing something correctly, because that's pretty much how one would swap panels in and out of the same real estate on a form. Just out of curiosity, have you considered a tab control? … | |
Re: You failed to give your structure a name. A typedef identifier is [i]not[/i] the same as a structure tag, but you can use the same identifier for both because they're in different name spaces: [code] typedef struct node { char v; struct node *next; }node; [/code] This produces the usual … |
The End.