5,676 Posted Topics
Re: Look up the SWITCH/CASE statement. You are using it incorrectly. | |
Re: Only call [B]srand()[/B] once at the beginning of the code. | |
Re: Look up [ICODE]srand()[/ICODE] and [ICODE]rand()[/ICODE]. Then use an [ICODE]if[/ICODE] statement. | |
Re: [QUOTE=mr.confused!;]In your opinion, when creating a nested loop is it best to use the call function and if so is using a pointer the route to go when creating the function?[/QUOTE] That's like asking when ordering a hamburger is it better to drive a Mustang? The things in your question … | |
Re: [QUOTE=~s.o.s~;1221196]Dani, please make it so that quotes are hidden by default...[/QUOTE] NOOOOOOOOOOOOOOO! Oh Please NO! | |
Re: #1) Use CODE Tags #2) [url=http://www.gidnetwork.com/b-38.html]Format your code[/url] so we can follow it #3) Are we supposed to guess what issues you are having? #4) You don't need a [B]switch[/B] statement, especially one like that | |
Re: [url=http://www.gidnetwork.com/b-58.html]Read this[/url] And start using CODE Tags. | |
Re: [url=http://www.gidnetwork.com/b-38.html]Format your code[/url] better and the problem will smack you in the face... | |
Re: [QUOTE=~s.o.s~;] @Everyone This is normally how new changes are rolled out on Daniweb. The new features which need to be introduced are made live, feedback is collected from regulars, changes are made to the site, rinse and repeat. I'm pretty sure that with the help of suggestions given by the … | |
Re: It would make much more sense to do this instead [code] ifstream Dict ("C:/Users/Brandon/Desktop/Programs C++/Dictionary.txt"); //file to read if (!Dict.is_open()) { return -1; /*error */ }; ifstream file ("C:/Users/Brandon/Desktop/test.txt", ios::out | ios::app | ios::binary); //file to write if (!file.is_open()) { return -1;/ /*error */ }; [/code] Why open the test … | |
| |
Re: If you're going to load [I]numlist[/I] with the list of primes, the loop [CODE] for (i=2; i<10000; i++) { numlist[i]=1; } [/code] is unnecessary. Also, what values will [I]numlist[0][/I] and [I]numlist[1][/I] contain? The [I]for[/I] statement is wrong [ICODE]for (p*p<=n; n<10000; p++)[/ICODE] The first field [I]p*p<=n[/I] cannot be a comparison to … | |
Re: But it's for a thread, not a post. It belongs at the bottom of the thread, maybe avove the reply box for easy access. | |
Re: #1) Do NOT Bump on these forums. It's rude. When someone that can help sees your post, they will answer. #2) There is no sense in making threads if only one thread at a time can be created. That defeats the purpose of threads. #3) A [iCODE]void[/iCODE] function cannot return … | |
Re: [QUOTE=Ketsuekiame;]If memory is not an issue and you're running on a fast machine there's no reason not to go with them for complex and large arrays. On a single dimensional array of 10 ints...There's no point choosing anything other than an array of int =)[/QUOTE] And, if someone is having … | |
Re: You did. [B]tkud[/B] tkud'd up... :icon_mrgreen: | |
Re: By SHOUTING at us. Please don't shout again. Are the lengths of [B]cm[/B] and [B]st[/B] the same? Output each [I]char[/I] in each string as an integer and see if they look the same. | |
Re: [QUOTE=JohnJ_21;362264]I was wondering if anyone could help me [/quote] We certainly can help... [QUOTE=JohnJ_21;362264](if you wanna do it... that would be awesome, i got 3 other finals in 2 days as well. Save me some time :) )[/QUOTE] Oops, you just lost my help here. If you had left out … | |
Re: You could, but a [I]real[/I] programmer wouldn't use [ICODE]scanf()[/ICODE] or [ICODE]fscanf()[/ICODE] to read strings in the first place. [B]Dave[/B]'s suggestion is the second best choice. Best is to use [ICODE]fgets()[/ICODE] | |
Re: [code=c] int remain1[8]; int remain2[8]; int remain3[8]; int remain4[8]; int * remain[] = {remain1,remain2,remain3,remain4}; [/code] Why? Why not a simple [ICODE]int remain[4][8];[/ICODE] ?? | |
Re: [QUOTE=ams_chelseafc]I have written the following Code which will convert an integer number to a roman..I have a array list of integer number which I pass through a for loop and the return value is individual converted Roman character.. My Issue is when the converted value is returned from the function … | |
Re: Don't know. What it do wrong? If you want help you really need to explain. Read the Member Rules. The thing I noticed is your [iCODE]srand()[/iCODE] is in the wrong place. Put it at the beginning of the program so it's called only once. | |
Re: [QUOTE=gerard4143;1217681]Don't and I mean don't ever use [CODE] gets(myString); [/CODE] Read Please BUGS Never use gets(). Because it is impossible to tell without knowing the data in advance how many characters gets() will read, and because gets() will continue to store characters past the end of the buffer, it is … | |
Re: A local variable ([B]str3[/B]) is deleted once the function ends. First, loop through the [B]to[/B] string to find the \0. Second, now loop through [B]from[/B] copying each character to [B]to[/B]. Return [B]to[/B]. | |
Re: [I]>The usual method used to convert a decimal to binary number is to store the successive numbers in a stack...[/I] Or in an array representing each bit. | |
Re: [QUOTE=GrimJack;1172015]... Sweden, Germany, [B]BeNeLux[/B], etc.[/QUOTE] Isn't [B]BeNeLux[/B] a vacuum cleaner? :icon_twisted: | |
Re: [QUOTE=Dinglish;1213130]i have a piece of an unfinished program. try to run it...[/QUOTE] No. If you post [I]readable[/I] code, we can follow it. Please format your code cleanly and consistently. [url=http://www.gidnetwork.com/b-38.html]See this[/url]. [QUOTE=Dinglish;1213130]if you go straight to option 3 and input values, how do i output these values in option 4 … | |
Re: [QUOTE=boiishuvo;1209065]The file is a text says "the quick brown fox jumps over the lazy dog", but when I ran the program, it showed some random number than I expected [/quote] No, it showed a specific number -- the value of [B]fp[/B] which is [I]not[/I] and integer displayed as if it … | |
Re: Look for an initialization file (maybe [B]db.ini[/B]) when the program starts. If the file does not exist, accept the connections string and any other values you need, write the data to the file. On each subsequent program starts, read the file to retrieve the values. | |
Re: Try posting your code readably and someone might be able to follow it. Indenting is a good thing, but indenting 8 characters is usually overkill, as your code shows. | |
Re: Open the file in binary mode and use binary output functions, not [I]fprintf()[/I] | |
Re: I'd say there's probably something wrong with the [I]rh.item[/I] matrix. Or switching the indecies is not the proper solution for your printing error. | |
Re: Because -- 1) when you are outputting data with [I]printf()[/I] you pass the value into the function. 2) when you are inputting values with [I]scanf()[/I] you pass the address of the variable so the value can be passed back. | |
Re: Please [url=http://www.gidnetwork.com/b-38.html]format your code[/url]. It is really difficult to read and follow. Because I can't read the code, I'll make a guess. You are defining an array of pointers, and attempting to stuff data into the pointers. But there is no data space defined. Just pointers. That will cause your … | |
Re: To move, you need another matrix. [B]board[/B] is for the current state, [B]newboard[/B] is for the next generation. Once you fill [B]newboard[/B] copy it into [B]board[/B]. | |
Re: Please look at the code you're posting. Can you actually read it? Please [url=http://www.gidnetwork.com/b-38.html]see this[/url], and maybe we can read it, too. | |
Re: If you are inputting into an integer variable, you cannot test for characters because they can't be entered into an integer. If you input into a string you can then test if the values are digits or not. | |
Re: Set up a 52 int array called [I]deck[/I]. Load each value with it's index: [iCODE]for (i=0; i<52; i++) deck[i]=i;[/iCODE] Now do what [B]iamthwee[/B] suggested. This becomes your shuffled deck. Each entry in [I]deck[/I] can be converted into a number/suit pair with / and %. Then use your [B]suitname[/B] and [B]numbername[/B] … ![]() | |
Just found this recipe, thought I'd share it: [url]http://www.cgl.uwaterloo.ca/~csk/water.html[/url] | |
Re: What is a point? What are it's parameters? What can you do with a point? Where can they exist? Basically, you need to create a class that can fully(?) defines what a point is, and decide what a point can be used for and create functions that can make the … | |
Re: How about [CODE] Dim I As Integer, MyCharacters As String MyCharacters = "ThisWord" For I = 1 To len(MyCharacters) MsgBox mid$(MyCharacters I1) Next I [/CODE] It's simple. No redimming or ubounding. | |
| |
Re: floatval= (int) floatval; | |
Re: [b]i[/b] is probably greater than [B]DIM_DICT[/B] |
The End.