not meaning to be picky and at the risk of confusing the op, but afaik in c the order of execution of statements separated by commas is not defined.
----edit----
oh, hang on, it appears i'm...
Type: Posts; User: howlingmadhowie; Keyword(s):
not meaning to be picky and at the risk of confusing the op, but afaik in c the order of execution of statements separated by commas is not defined.
----edit----
oh, hang on, it appears i'm...
I'm afraid i've never looked at haskell, but as a fan of stateless programming i should really do so at some stage. People who use it often say it's the bee's knees.
Cool :) lots of entries :)
but none of them from a true beginner :( maybe the problem is too difficult :(
i'll have a look at them later on today :)
Yeah, it's silly syntax which could so easily have been different. In other computer languages it is different too. For example
# in c
x=x+1;
; in scheme
(set! x (+ x 1))
#in c
i think my main problem with oop is that it's rather difficult to extract combinational how-to knowledge without making arbitrary decisions.
an example.
let's say we have a frying pan and an...
okay, here it is: http://ubuntuforums.org/showthread.php?p=9723093
let me know if i've made a mistake or it's unclear or whatever :)
Welcome to the Beginner Programming Challenge 15! woot! (i wonder if you spell it like that).
Well, i was trying to find something useful that you could actually use in a building block for a...
no, i'm not sure we think like that. unless you allow multiple inheritance and prototyping.
an example: think of something green. immediately you have a whole hierarchy of green things in your...
ah, the feynman problem solving algorithm :)
Ferrat gave a good answer on the last page. something like this should do it:
n1=random()
n2=random()
n2=random()
n4=random()
weight=100/(n1+n2+n3+n4)
r1=round(n1*weight)
oh, sorry. the next programming challenge will be up soon :)
declining is more than that. for example in german:
the second star wars film was made in 1982
der zweite (second, male nominative strongly declined) "krieg der sterne"-film wurde 1982 gedreht
...
in a number of languages you have the problem that ordinal numbers decline. this would make the task even more convoluted.
in php:
<?php
$fp=fopen("myfile.txt", "x");
?>
will create a file and fail, if the file already exists.
don't worry about writing your own language for now.
i'd say that programming nowadays consists of 2 things:
1/ what you want to do and
2/ expressing that in a particular language.
both of...
thinking about php some more, it does have a few interesting reflection shortcuts, which make programming with it a bit easier.
you can do something like this, for example:
class MyClass {...
for ruby it's called eruby: http://en.wikipedia.org/wiki/ERuby
you have to install the eruby package.
for python it's called python server pages or just psp, you just have to install mod_python...
i don't know ruby, but does this actually work as intended? or does x get overwritten in the line
x = a*x + b*y
so the result of
y = c*x + d*y
okay, i've now checked it with valgrind and freed all the mallocs :)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define RAD_PER_DEG (M_PI/180)
hello again :)
here's a shortish solution in C. it's been a while since i've done any C programming, and i haven't freed every malloc, so it's a bit of a work in progress.
#include...
just to complicate matters further i think i should point out that one school of thought says that a compiler like the gnu compiler collection takes an input in various formats (c, c++, fortran...
one thing worth noting is that the command separator for sed doesn't have to be a '/', so you could instead write it like this:
sed 's:\(<caption\)[^<]*\(</caption>\):\1\2:g' file.xml >...
a small correction. consider the point [-1, 1], which lies on the line y=-x, and so would not be affected by a reflection through y=-1x. multiplied by a scale of -1 this point becomes [1, -1].
a...
i'm quite happy to take nes's entry as a comment. as dv has pointed out, it isn't quite trivial to get it running on an ubuntu system. but it does contain lots of very interesting ideas, for example...
well, there are different ways to sort lists. one of the easiest ways would be like this in pseudocode:
function sortOneItem(aList, start) {
positionOfLowestItem=start
for(i=(start+1);...