5,676 Posted Topics
Re: You can't use [I].eof()[/I] in this manner. You don't hit EOF until you actually try to read past end, not when you read the last character. Therefore, you will go through your loop the final time after reading bogus data. Read the first characters before the loop. Then read the … | |
Re: Agreed. A message box that says something like "[I]Are you posting code without using CODE tags? YES NO[/I] NO dismisses the box and they can add the CODE tags if they need and know how. YES opens a complete description of how to use them. The only question is how … | |
Re: You don't. The C++ standard does not allow for "hit any key" type input. You need to change your prompt to "Press ENTER to continue" | |
Re: I prefer to have menu do the menu only. No loops, no decisions. It returns the selection to the calling function where it is analyzed and acted upon. Each function should do what the name implies, not a bunch of additional work. | |
Re: Did someone ignore the request to read the Member Rules that mentions CODE Tags? Or the info at the top of the forum that talks about CODE Tags? How about the background of the text box where the message was entered that also mentions CODE Tags? What could we have … | |
Re: So turn your comments into code. We aren't a coding service, we help you fix your code that's wrong. Your code isn't wrong, it's non-existant. Also, explain the problem you're having. All you say is your problem is with random numbers. I see nothing about random numbers in your code, … | |
Re: [QUOTE=hdb25;]Ok so the program compiles fine, but when I actually run it, it is not printing out the result of intobin(hextoint(st))[/QUOTE] So finish formatting your code properly and post it. We can't do anything if we can't see the current code. And please explain [I]in detail[/I] what's wrong, not just … | |
Re: Why? What is it you don't understand? Looks straight forward to me. | |
Re: [QUOTE=Perry31;]Better use short or short int for age variable since this has the least range other data type. [/quote] Shorter than [B]char[/B]? I don't think so... [QUOTE=Perry31;]Use cin to read the age variable.[/quote] You realize this is the [B]C[/B] forum, right? That code can't possibly help. | |
Re: Try looking up the syntax in your text. There's no way you wrote all that code without some form of book or on-line help. | |
Re: When you enter the number of books, the \n you typed is still in the input buffer. This is read as the first input in [I]Initialize()[/I]. Look at the [I]cin.ignore()[/I] method | |
Re: I have no idea what you are trying to do. A better or more detailed example is needed. [QUOTE=-ordi-;1173129]My bad english![/QUOTE] You don't say! :icon_wink: We can get over that... | |
Re: Stop using [inlinecode]fscanf()[/inlinecode] and use [inlinecode]fgets()[/inlinecode] instead. [inlinecode]fscanf()[/inlinecode] is not good (nor safe) the way you are using it. Especially with postal codes. Since you are using the data as a string, you didn't leave room for the ending '\0' Also, [url=http://www.gidnetwork.com/b-62.html]read this[/url] about [inlinecode]scanf()[/inlinecode], which applies to [inlinecode]fscanf()[/inlinecode] too. | |
Re: You have to specify a value, not a variable, when defining an array: [CODE] double x[16][2];[/CODE] | |
Re: [B]%cat t1[/B] proves [I]t1[/I] is a file. What the [I]5[/I] is for on the [B]$ ./a.out 5 t1[/B] I don't know. It's unnecessary. The command should simply be [B]$ ./a.out t1[/B] So what does your program do? What did you expect it to do instead? | |
Re: Forget the [I]fseek()[/I]. Just don't output the space when you've output the last value. Don't output the value and the space together. Output them separately so you can control each of them. | |
Re: A lookup table is a list of values. You define the array and it's values at compile time: [CODE]float sinLookup[] = { val1, val2, val3, ... };[/CODE] Each entry corresponds to one angle you want available. Get the angle, use it as an index into the array to get the … | |
Re: If you use [B]endl[/B], you will always get one line for each output. Use [B]endl[/B] only after outputting 3 values. | |
Re: Unload the workbook form from the unload method in the password form. | |
Re: [QUOTE=Fbody]Because it's simply a pointer to a single char, there is not sufficient memory allocated where that char is stored to hold an array of char.[/QUOTE] Actually, there isn't even a single char. It's just a pointer to nowhere in particular. | |
Re: Search the string for the digits, pull the substring out, then convert. | |
Re: Start by asking for the binary number. Then check the number for illegal characters. | |
Re: And keep in mind 5/9 = 0. That's integer arithmetic. You want 5.0/9.0 to get the correct answers. | |
Re: I agree, the assignment is so poorly described it's really hard to understand. The assignment is: Ask user for a number [B]N[/B] representing the maximum number of digits for two integers you wish to add. (ex- enter 4 for 2 4-digit numbers, enter 20 for 2 20-digit numbers) Ask for … | |
Re: Try [url=http://www.google.com/search?q=autocomplete+textbox+vb6&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a]autocomplete textbox vb6[/url] | |
Re: [QUOTE=miha2;]for each character? that way the code will be too long, and I for some reason don't see a void or any other user defined function... [B]IT HAS TO BE IN HERE![/B] it's all my homework is about.[/QUOTE] So you were expecting us to write your program for you? Not … | |
Re: [QUOTE=saranyashanthi;]hai can any one help me to write the codings for hospital management in visual basic on basic forms of bloode donation list,admission form,etc[/QUOTE] Since we aren't medical professionals, not with the information given. But we [I]can[/I] help with the coding when you get stuck. | |
Re: You call [iCODE]stack()[/iCODE] to initialize the stack. You only need one stack. You call [iCODE]push()[/iCODE] to put values on the stack. You call [iCODE]pop()[/iCODE] to remove values from the stack. That's about it... When you calculate one of the digits, [I]push[/I] it. When done, start [I]pop[/I]ping. | |
Re: First, [url=http://www.gidnetwork.com/b-38.html]format your code[/url] so we can follow it. Replace the value in the array with -1 for X and -2 for O. Then during output, display the letters instead of numbers for negative values. | |
Re: [QUOTE=jnick12;]Cool I see how that works. Thanks! Where should I enter system ("cls") to clear the screen though?[/QUOTE] Nowhere!!!! It's unprofessional to clear the screen for no real reason. It's also programming for a specific operating system so it's not portable. Unless there's an actual need to execute a child … | |
Re: You'll have to read the input as a string and test each character to be sure they are digits. If they are, convert the input to a number. This would make a great function. Return the number or -1 if not a number. | |
Re: [QUOTE=tkud;1115158]The only way for us to understand your problem is for you to post your code.[/QUOTE] I think a better description of the problem would help -- not the code... | |
Re: I have no idea what [B]newToCheck[/B] is for. Line 8 defines it as a char pointer. No size so there's no storage. Line 29 seems to serve no purpose at all. Line 31 uses [B]newToCheck[n][/B] but the location has no storage space, so even if you tried to run the … | |
Re: Try [url=http://www.gidnetwork.com/b-38.html]formatting your code[/url] so we can follow the program flow. As it is, it's hard to follow. And give us a clear explanation of what your problem is, as well as an attempt to solve it. | |
Re: You don't need boost for recursion. Just call function traversing the directory while traversing the directory. Your compiler will probably have filesystem commands to walk through a directory ([iCODE]findfirst()[/iCODE] and [iCODE]findnext()[/iCODE] type of functions). Check your compiler documentation. | |
Re: If [I]players[/I] is global, why are you passing it around? I believe you are not changing the global variable but the local variable passed in by value. | |
| |
Re: Use a combination of: LEFT function String Length function | |
Re: Help with what? Do you really expect us to search through 246 lines of code looking for some unknown problem? When asking for help, you need to explain in detail what you need help with. | |
Re: Another problem. [iCODE]srand()[/iCODE] should only be called once during program execution. Move the function call to the beginning of [iCODE]main()[/iCODE] | |
Re: Actually, the best solution is to make the variable an [B]int[/B] rather than [B]unsigned[/B]. That is assuming your 'fuel' will never go beyond 2+ billion | |
Re: Because you did something wrong. That's why you're getting that error. And since we can't see your code, that about as much as we can guess at. Your description tells us nothing useful. | |
Re: That is some of the worst code I've seen! 16 lines with the following problems: 1) void main() -- main is ALWAYS an int. 2) clrscr() -- no current compiler has this function and it's a bad idea to use it in the first place. 3) gets() -- the most … | |
Re: [CODE]if char = '.' then print ' ' else print char if char = ' ' then print '.' else print char[/CODE] something like that. | |
Re: Umm, they are both 4 digit values, each has 3 distinct digits. Based on the values, they may be father and son. If this is not helpful, maybe you can clarify what you mean by 'relationship' | |
Re: From [url=http://www.cplusplus.com/reference/clibrary/cstdlib/system/]this reference[/url]: [QUOTE][system()] Invokes the command processor to execute a command. [B]Once the command execution has terminated[/B], the processor gives the control back to the program, returning an int value, whose interpretation is system-dependent. [/QUOTE] This says that your program waits until the command executed with [iCODE]system()[/iCODE] finishes. Does … | |
Re: 1/1! is not 0, it's 1. Do the math -- what is 1!? | |
Re: So why don't you post your current code in the python forum? :icon_rolleyes: |
The End.