5,676 Posted Topics

Member Avatar for I_m_rude

4th option: Make a zeroed array of 5,00,000 integers. For every integer read, use it as an index into the array and increment that entry. When done, the value that's 1 was read once. But **shanki himanshu**'s solution seems to be the most efficient. It's a really slick solution.

Member Avatar for Ancient Dragon
0
103
Member Avatar for aratnon
Member Avatar for TheEroteme

>First, is there any way that I can do this more efficiently, ... First thing is compile the program and fix the errors. There's generally no reason to enhance a program that won't compile in the first place or runs improperly. > ...and second, what is the easiest way to …

Member Avatar for Kwetal
0
180
Member Avatar for benk1

You should avoid `goto` completely. After 30 years in C, I've never needed one. Restructure your program to use one of the 3 loop structures. As for *why* it executes twice, when you type your answer, how many keys do you actually press? What do you think is now happening? …

Member Avatar for WaltP
0
150
Member Avatar for rithish

Does it work? If so, probably. Test it with a lot more data. If not, no. Please don't use `getch()` at the end of programs. It's non-standard and when you get to a *real* compiler, you'll have problems. What to replace it with? Well, what does `getch()` do? What standard …

Member Avatar for WaltP
0
108
Member Avatar for np complete

Not bad... Here are some possible things you could consider for improvements: ------------------ Because *coinval* is a `#define` it should be in all caps. And while you're at it, define the heavy and light values too: #define COINVAL 2 #define COINHEAVY 3 #define COINLIGHT 1 Also, make the values for …

Member Avatar for WaltP
0
361
Member Avatar for PinoyDev

Of course. Parse the string into it's components (a 17 and a 30). Fill a time *structure* (defined in `time.h`) with the appropriate values. Call the appropriate time function in to convert the structure into **time_t**.

Member Avatar for deceptikon
0
4K
Member Avatar for Azurea

[QUOTE=sgw;544665]Thanks for the link. I just read your post there. So it looks like unless you use cin.ignore(), you would always need to type cin.get() twice. There's no cleaner way...[/QUOTE] Yes, there are cleaner ways. First is to not use [ICODE]cin[/ICODE]. Read a full line into a [I]char*[/I] or a …

Member Avatar for WaltP
0
617
Member Avatar for aasi007onfire

I don't like the explanation you've received for "undefined behavior". What this means is the C Standard has not defined the operation, and what it is supposed to do. Therefore, any given compiler can do what they want. For[INLINECODE]fflush(stdin)[/INLINECODE], the compiler designers can write the compiler to: 1) do nothing …

Member Avatar for Ancient Dragon
0
193
Member Avatar for shashikumar s g
Member Avatar for GrimJack

[QUOTE=Ancient Dragon;1098772]and the fastest modem available was 300 baud.[/QUOTE] or the teletype hardwired to the computer that takes up an entire room runs at a blazing 110 baud! [QUOTE=almostbob;1099892]I still have 3 paper tapes ascii art (if you squint a bit) ladies scantily attired just need somebody with an ibm …

Member Avatar for vinnitro
1
3K
Member Avatar for Microno

Also, if you don't understand `stringstream` there are two avenues: 1) Don't use `stringstream` 2) Learn how `stringstream` works by writing a bunch of test programs that will teach you various aspects of it. Also your formatting needs a lot of work. You code is almot impossible to read and …

Member Avatar for ravenous
0
175
Member Avatar for aero31aero

**[boilerplate_help_info]** Posting requests for help must be well thought out if you want help quickly and correctly. Your post did not meet the criteria for quality help. You may get some posts, but are they going to be useful? Check your post with these checkpoints - what is it *you* …

Member Avatar for WaltP
0
236
Member Avatar for sudhanshu.srivastava.7

None that I know of, since C is not controlled by a single company like Java.

Member Avatar for I_m_rude
0
132
Member Avatar for fahad.alsharafi.1

**[boilerplate_help_info]** Posting requests for help must be well thought out if you want help quickly and correctly. Your post did not meet the criteria for quality help. You may get some posts, but are they going to be useful? Check your post with these checkpoints - what is it *you* …

Member Avatar for deceptikon
0
133
Member Avatar for princess128
Member Avatar for PinoyDev

> I havent tested the above code? Why not? How do you know what needs to change if you haven't bothered to try it? > Any correction? Too much to go into. Based on what you've posted you need to go way back to the basics. Like 1) the infamous …

Member Avatar for deceptikon
0
435
Member Avatar for Remzz

> Another approach is to use the strtod(const char* nptr, char** endptr) function. > > You could use boost::lexical_cast to try and convert the string to a number I'm curious how these two approches actually *test* for valid values. Won't they both simply convert whatever it can to binary and …

Member Avatar for Remzz
0
210
Member Avatar for didi00

> I am able to successfuully build my DOS aps under this compiler on WinXp, I wouldn't try to run it though. Why not? I've successfully built and run Turbo 1.0 graphics code in WinXP.

Member Avatar for gibson.elliot.5
0
254
Member Avatar for ronnel09

> Calling main() from within main() would be an example of recursion, and not looping. > ------ > its not loop. Its just "calling the main function" we don't consider it a loop. Actually, it's called a *recursive loop*, so yes, recursion **is** a loop. > A loop is a …

Member Avatar for _avishek
0
105
Member Avatar for Dani

I like option 1. I don't need to automatically see comments, but when I want to see them it would be nice to have "show comments" only when there are comments.

Member Avatar for Dani
0
129
Member Avatar for Ancient Dragon

And why is the related article imbedded in the first post? That just seems wrong since it wasn't posted by the OP. At least put it *after* the post.

Member Avatar for gerbil
0
231
Member Avatar for ruudycruise

Copy the text boxes into an array. Sort. Write the array back into the Text boxes.

Member Avatar for AndreRet
0
148
Member Avatar for PinoyDev

And yet another "*not totally working*" post, as if we're supposed to know what that means. When asking for help, give us information. Don't make us guess what "*not working*" means.

Member Avatar for np complete
0
238
Member Avatar for I_m_rude
Member Avatar for kovacsakos

> I would like to ask only a good algorithm for this problem. Then explain what you don't understand and **IN DETAIL** explain what you need the program to do.

Member Avatar for WaltP
0
120
Member Avatar for usdblades
Member Avatar for SgtMe

Why would you want the data explosed to the outside? Use a *get* method to expose the location. If you want to see the value of location 0,0, return the location with `val = level1.getMapLoc(0,0);`

Member Avatar for SgtMe
0
178
Member Avatar for sandeshn

> I'm not sure what the situation is in India where the original poster is from... But you can bet the boxes are programmed using Turbo C....

Member Avatar for sandeshn
0
163
Member Avatar for rithish

> total=total+(pow(n,i)\fact(i)); Take a *closer* look at this equation. Specifically the math symbols.

Member Avatar for _avishek
0
100
Member Avatar for phil.sutton

**Consistent** formatting is the key. [See this](http://www.gidnetwork.com/b-38.html) and refine your indentation. I believe this will fix your problem when you indent properly.

Member Avatar for phil.sutton
0
189
Member Avatar for bugstalker

I would recommend you stay away from all practices/function/headers that are compiler/OS dependent. Unlearn `conio.h` since only 1% of the compilers ever made have it defined. And of those compilers, each `conio.h` is different.

Member Avatar for Ancient Dragon
1
1K
Member Avatar for shanki himanshu
Member Avatar for ronnel09
Member Avatar for WaltP
0
301
Member Avatar for c_program_user

>Does anyone know what I am doing wrong? Mainly, if it's supposed to be a string, where's the space for the \0 that terminates a string?

Member Avatar for c_program_user
0
178
Member Avatar for kovacsakos

Why 0-5, 6-9, 12-13? Why not 0-3, 4-8, 9-13? Or 0-1, 2-3, 4-5, 6-8, 9-13? > My attempt is here, but there is a problem with this: So what's the problem with *this*?

Member Avatar for WaltP
0
138
Member Avatar for misi
Member Avatar for misi
1
241
Member Avatar for nitishok

> Also use a vector as **the array isn't contingously aligned**. It isn't? Please explain... And why do you guys always suggest vectors when they are obviously beyond the scope of their knowledge? What do you think would happen when they turn in their homework with vectors which hasn't been …

Member Avatar for WaltP
0
289
Member Avatar for love_you_4rever

> what will print Nothing. There are no output statements. Assuming that's not the correct answer, sit down with pen and paper and figure it out. Write down the variables and their contents Write down the pointers and where they point Now follow the code statement by statement

Member Avatar for WaltP
0
114
Member Avatar for nabeelbhutto

plz try to understand please read deceptikons msg he tells you correct stuff and dont cry be a big boy and stop begging you sound like a whiney 3-year-old and you must be 13 years old to post here

Member Avatar for sfuo
0
732
Member Avatar for triumphost

Can't tell from what you posted whether **BufferData** points to a valid buffer or random memory. That's could be why you get different values.

Member Avatar for triumphost
0
222
Member Avatar for Xeros

Can you be less vague? Not one win condition works? Some work but not others? All but one works? And where should we start looking? This is like looking for a needle (vague idea what we're looking for) in a haystack (371 uncommented lines of code)

Member Avatar for WaltP
0
1K
Member Avatar for anupverma

> **My boss** has seen this & **has disabled** the dowloading of videos from my computer. Doesn't that sentence tell you anything?

Member Avatar for WaltP
0
165
Member Avatar for Pyler

> For those interested here it is. Now how do you delete posts? If the post was deleted, why would we be interested? ;o)

Member Avatar for WaltP
0
2K
Member Avatar for manishanibhwani

Yes, it's precision, and double is simply more accurate. That does not equate to bigger. For example: `double` may be 56.42735816, float may be 56.42736 -- `float` is bigger.

Member Avatar for rubberman
0
147
Member Avatar for logicmonster

Posting Questions Lesson number 1: "[I]This is wrong[/I]" doesn't cut it. [I]What[/I] is wrong? Always provide details. Only you know what happened, so you need to tell us a) what happened b) what should have happened. Remember, we cannot see your screen. You need to post all information that is …

Member Avatar for lance p
0
312
Member Avatar for phorce

Depends on how **blocks** is ultimately defined. Depends on what **length(blocks)** returns. Depends on what **size(blocks)** returns. Depends on what **sum(size(blocks))** returns. There are a lot of possibilities on each of the above. Unless there's a *Matlab* user that can answer these questions, we'd be just guessing.

Member Avatar for WaltP
0
126
Member Avatar for david.marduk.7

Most likely mis-matched braces. If you would [indent in a consisent manner ](http://www.gidnetwork.com/b-38.html), that type of error would never show up.

Member Avatar for WaltP
0
458
Member Avatar for shanki himanshu

Then, as **deceptikon** says, it's not supported by that compiler. Write your own.

Member Avatar for WaltP
0
2K
Member Avatar for coolikedat99

*[pedantic]* Since the hottest recorded temperature is a mere 3.6 billion degrees, why would you care if the program worked for 10 Quattuordecillion? *[/pedantic]* Actually, the problem is the limits of binary math. 45 digits is too many for computers handle. The only way to cleanly deal with numeric abnormalities …

Member Avatar for NathanOliver
0
298

The End.