5,676 Posted Topics

Member Avatar for Philosophy

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 …

Member Avatar for Philosophy
0
497
Member Avatar for daviddoria

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 …

Member Avatar for jon.kiparsky
0
430
Member Avatar for skorm909

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"

Member Avatar for skorm909
0
3K
Member Avatar for nickx522
Member Avatar for WaltP
-2
69
Member Avatar for jeremy62

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.

Member Avatar for Shankye
0
263
Member Avatar for shellac85

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 …

Member Avatar for Shankye
0
211
Member Avatar for skorm909

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

Member Avatar for jonsca
0
146
Member Avatar for hdb25

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

Member Avatar for hdb25
0
173
Member Avatar for nepkancha
Member Avatar for WaltP
0
119
Member Avatar for alexchen

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

Member Avatar for alexchen
0
136
Member Avatar for dudman

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.

Member Avatar for dudman
0
155
Member Avatar for knellgust

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

Member Avatar for knellgust
0
102
Member Avatar for -ordi-

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

Member Avatar for -ordi-
0
142
Member Avatar for Shaabangbang

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.

Member Avatar for mfaisalm
0
231
Member Avatar for fussballer

You have to specify a value, not a variable, when defining an array: [CODE] double x[16][2];[/CODE]

Member Avatar for mitrmkar
0
244
Member Avatar for arineon

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

Member Avatar for WaltP
0
2K
Member Avatar for gahhon

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.

Member Avatar for gahhon
0
97
Member Avatar for fussballer

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 …

Member Avatar for Adak
0
238
Member Avatar for Abayiz

If you use [B]endl[/B], you will always get one line for each output. Use [B]endl[/B] only after outputting 3 values.

Member Avatar for Abayiz
0
170
Member Avatar for shabadoo
Member Avatar for abelingaw
0
112
Member Avatar for vanalex

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

Member Avatar for WaltP
0
67
Member Avatar for tech9x
Member Avatar for WaltP
0
74
Member Avatar for harunosakura

Start by asking for the binary number. Then check the number for illegal characters.

Member Avatar for Lerilaine
0
199
Member Avatar for sing1006
Member Avatar for sing1006
0
336
Member Avatar for yoyo59

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 …

Member Avatar for WaltP
0
109
Member Avatar for Naveed_786

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]

Member Avatar for AndreRet
0
161
Member Avatar for miha2

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

Member Avatar for miha2
0
745
Member Avatar for saranyashanthi

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

Member Avatar for PoisonedHeart
0
84
Member Avatar for anthonys1mom

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.

Member Avatar for mitrmkar
0
2K
Member Avatar for tKc

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.

Member Avatar for WaltP
0
225
Member Avatar for jnick12

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

Member Avatar for WaltP
0
1K
Member Avatar for jnick12

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.

Member Avatar for WaltP
0
1K
Member Avatar for MichaelSammels

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

Member Avatar for MichaelSammels
-1
195
Member Avatar for garu525

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 …

Member Avatar for garu525
0
180
Member Avatar for geryin

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.

Member Avatar for WaltP
0
182
Member Avatar for cmccaig

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.

Member Avatar for Taywin
0
964
Member Avatar for gmfreak1991

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.

Member Avatar for Fbody
0
175
Member Avatar for philipB
Member Avatar for bklynman01
Member Avatar for PinkyMV

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.

Member Avatar for dexter321
0
3K
Member Avatar for nickx522

Another problem. [iCODE]srand()[/iCODE] should only be called once during program execution. Move the function call to the beginning of [iCODE]main()[/iCODE]

Member Avatar for Nandomo
0
98
Member Avatar for russellquin

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

Member Avatar for Duoas
0
92
Member Avatar for oggiemc

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.

Member Avatar for oggiemc
0
94
Member Avatar for berwick53
Member Avatar for vbx_wx

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 …

Member Avatar for vinitmittal2008
0
289
Member Avatar for brycematheson

[CODE]if char = '.' then print ' ' else print char if char = ' ' then print '.' else print char[/CODE] something like that.

Member Avatar for WaltP
0
126
Member Avatar for TheebanRaj

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'

Member Avatar for WaltP
0
37
Member Avatar for triumphost

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 …

Member Avatar for triumphost
0
153
Member Avatar for modesto916
Member Avatar for ralphcatech

So why don't you post your current code in the python forum? :icon_rolleyes:

Member Avatar for SgtMe
-1
80

The End.