What's all that business with variable min? It's just confusing things.
You need to put the smallest value from the rest of the array into the first position, then repeat for the second position,...
Type: Posts; User: risby
What's all that business with variable min? It's just confusing things.
You need to put the smallest value from the rest of the array into the first position, then repeat for the second position,...
That works. Thanks all.
Can I just ask why you posted this? It makes me think I've done something wrong.
And, btw, what has happened to Tek-Tips? It's been down for the last couple of hours.
That looks good. I've tried it and it works fine with stdin but fails to read anything from a file. I'll play around with it though, thanks.
Hi peeps
Can anyone tell me what must be a fairly standard incantation?
About a decade ago I wrote
ifstream fin;
if (NULL == inputStream)
True, swgh, but of all the examples of famous mathematicians you could have chosen, mathematicians with strong computing connections like John Conway or Donald Knuth, or even famous female...
It does seem like a strange question - here's my strange response.
A language that can do everything that the computer can do is its processor's assembly language. Unfortunately the computer can...
You haven't declared character variable z and you haven't passed the address of that variable as a parameter to scanf(). Otherwise it's OK, but the prompt isn't very helpful to the user about what it...
Oh yeah ... it's that other one init ... I'm always getting those two confused ... um ... ?
As you say, bubble sort swaps adjacent elements. It also sets a flag to show that a swap has taken place and repeats until the flag remains unset on a pass through the array.
This is a Shell sort...
No, I was thinking of something like:
double tm; /* <-------- for storing fractional part */
lc = jdn; /* <------ this gets the integer part; the number of days */
tm =...
Hmmm, let's see now ...
111111.111111 * 6 = 666666.666666
Perhaps you'd better write a test harness for your algorithm Queatrix
If you truncate the double jdn by storing it into a long integer and then subtract that integer from jdn you'll be left with the decimal part. You could then multiply by 1,000,000 to move it up past...
Don't you count the modulus operator '%' as an arithmetic operator then?
Yeah, it is mighty difficult to translate to human speech. Try this:
given n is a non-zero positive integer the outer loop executes n times
each time limiting the inner loop index to vary from 1...
Nice, Max. Kudos.
I would say that real life does not have sort of clear answers for which you seem to be looking. There is no finishing line to cross unless you are doing some sort of academic qualification or,...
OK Ralphy, that's good to hear, keep up the good work.
Now, he he, there's just one little thing. How many times will each loop execute?
No, it doesn't!
No, it doesn't!
Here is some info about for loops where you'll learn things like "initialization allows you to give a value to a variable, the condition tells the program...
A couple of weeks ago I was checking to see if there was a more recent java development kit from Sun and I found Netbeans 5.0. I've not yet played around with it but it is for Java development not C...
Ah ha!
#define LINUX_REBOOT_MAGIC2B 369367448
369367448 decimal = 16041998 hexadecimal
16041998 could be viewed as 16th April 1998
Linus Torvalds' second daughter, Daniela Yolanda,...
LINUX_REBOOT_CMD_RESTART 0x01234567 ---> first 8 congituous digits
LINUX_REBOOT_CMD_HALT 0xCDEF0123 ------> last 4 contiguous digits followed by first 4
LINUX_REBOOT_CMD_CAD_ON 0x89ABCDEF...
If those are addresses I'll eat my hat. They are ordered sequences of hex digits. Even MAGIC2B is 0x16041998, I wonder what is significant about the 16th of April 1998.
Oranges are spherical and coloured orange. Bananas are more cylindrical and coloured yellow, often with black spots.
I do not like foo, bar and baz
I just can't cope with all that jazz
I do not like them in my code
I won't be going down that road
They won't appear in my program
Not even for green eggs...