6,741 Posted Topics

Member Avatar for Ancient Dragon

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. ;)

Member Avatar for Netcode
0
103
Member Avatar for Elmey

[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 …

Member Avatar for Narue
0
288
Member Avatar for surajrai

[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 …

Member Avatar for Narue
0
407
Member Avatar for daldrome

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 …

Member Avatar for daldrome
0
160
Member Avatar for PapaGeek

[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.

Member Avatar for thines01
0
170
Member Avatar for methosmen

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; …

Member Avatar for methosmen
0
273
Member Avatar for ramki*89

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).

Member Avatar for N1GHTS
0
91
Member Avatar for needforkevin

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 …

Member Avatar for needforkevin
0
340
Member Avatar for Nikesh2014

No code tags, a bunch of code, and no question. Awesome. :icon_rolleyes:

Member Avatar for Schol-R-LEA
0
134
Member Avatar for shravani1

Function calls use parentheses, not braces: [code] System.Console.Writeline("this is my program") System.Console.ReadLine() [/code]

Member Avatar for shravani1
0
266
Member Avatar for arc45

[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 …

Member Avatar for shinnoon
0
2K
Member Avatar for Muhammad Anas

[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 …

Member Avatar for Muhammad Anas
0
3K
Member Avatar for faami

[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]

Member Avatar for Narue
0
48
Member Avatar for nikitadurgude

[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 …

Member Avatar for Narue
0
213
Member Avatar for Kinneranand

[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) == …

Member Avatar for Narue
0
71
Member Avatar for Santi1986
Member Avatar for Ich bin würdig

[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' …

Member Avatar for Ich bin würdig
0
155
Member Avatar for ~s.o.s~

[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 …

Member Avatar for Dani
2
358
Member Avatar for iamthesgt

An error like [I]what[/I]? Are we to supposed to read your mind to see the error message?

Member Avatar for iamthesgt
0
274
Member Avatar for ben1996123

[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 …

Member Avatar for ben1996123
0
120
Member Avatar for Tellalca

[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 …

Member Avatar for Narue
0
173
Member Avatar for zeroliken

[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 …

Member Avatar for Narue
0
237
Member Avatar for meandmyipod

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 …

Member Avatar for Narue
0
114
Member Avatar for theCompiler

[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 …

Member Avatar for Narue
0
95
Member Avatar for The 42nd

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]

Member Avatar for TrustyTony
0
2K
Member Avatar for wanguard

[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 …

Member Avatar for wanguard
0
217
Member Avatar for swissknife007

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 …

Member Avatar for Narue
0
508
Member Avatar for jnmisa

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( …

Member Avatar for jnmisa
0
989
Member Avatar for zeroliken

[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.

Member Avatar for zeroliken
0
501
Member Avatar for The 42nd

[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 …

Member Avatar for The 42nd
0
314
Member Avatar for peter20

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.

Member Avatar for Narue
0
124
Member Avatar for geeknick

[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 …

Member Avatar for Rashakil Fol
0
107
Member Avatar for amit28it

[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 …

Member Avatar for Rashakil Fol
0
124
Member Avatar for rathanm

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 …

Member Avatar for rathanm
-2
282
Member Avatar for lilsancho

[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 …

Member Avatar for Narue
0
189
Member Avatar for klimburt
Member Avatar for lmddigital

Please confirm which name you wish to use, I can only give you one. :icon_rolleyes:

Member Avatar for Narue
0
153
Member Avatar for nav07

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]

Member Avatar for nav07
0
3K
Member Avatar for amitshree
Member Avatar for zeus god

[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 …

Member Avatar for YAMNA MIDHAT
0
240
Member Avatar for jean122

[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.

Member Avatar for Narue
0
230
Member Avatar for onat12`

How in the world can you destroy all formatting when you're obviously using Visual Studio to write the code in the first place?

Member Avatar for prit005
0
496
Member Avatar for dbuckle

[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.

Member Avatar for Narue
0
211
Member Avatar for strRusty_gal

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 …

Member Avatar for Narue
0
96
Member Avatar for Aghtar

[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.

Member Avatar for MandrewP
0
1K
Member Avatar for skylinedrifter

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.

Member Avatar for thines01
0
146
Member Avatar for BenzZz

There's a Text property that supports both getting and setting: [code] s1Textbox->Text = gcnew String(ss.str().c_str()); [/code]

Member Avatar for BenzZz
0
68
Member Avatar for karthik.datt

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 …

Member Avatar for WaltP
0
169
Member Avatar for auwi987

[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? …

Member Avatar for auwi987
0
139
Member Avatar for vikaasgoel.007

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 …

Member Avatar for Narue
0
154

The End.