G
gswork
Let's write a c program, without knowing what it does...
Some of you may recall Jim Roger's excellent series of posts (on
comp.programming) exploring the implementation of common software
activities in different languages by requesting small working programs
as source.
Well, having thought & read about the benefits of teamwork, oss,
extreme programming etc i thought, instead of writing software that
has a known purpose - why not do the opposite, write a program the
purpose of which isn't known until it's done!
Kinda like the write a line and pass it along game of storytelling.
Now, i'm not sure if this will register as fun to anyone, or if it
will work out, but.....
I'd like some volunteers to write the functions that's aren't detailed
in the standard C program below.
I chose standard C because it's well known and cross posted to c.l.c
because clc residents can help pick out code issues, and perhaps have
some fun too - or just question the pointlessness of this exercise!
Hope this doesn't offend the purpose of clc.
Just pick one function, whatever you like, and write the function in
any way you see fit so that it will robustly fit into the simple
program below, the more imaginative it is, the more it will stretch
robustness and (hopefully) demonstrate the value of standards and
structured programming, or something..:
#include <stdio.h>
/* function definitions missing! */
int main()
{
int num1,num2,num3;
num1=GetAnInteger();
num2=GetAnInteger();
num3=DoAnOperation(num1, num2);
DisplayResult(num3);
return 0;
}
Note that anything that returns an integer must return a valid integer
whatever the size of int on the target platform. So the person who
chooses 'DoAnOperation' has an extra challenge, in designing something
interesting that produces a meaningful return (though it doesn't
*have* to be meaningful!). The other two functions might be easier,
but who knows what you may come up with.....
Regardless of the content of the functions, we should all be able to
compile any combination using the above on an iso standard compliant c
compiler and get a working program, even though we never planned what
it should do in detail!
Some of you may recall Jim Roger's excellent series of posts (on
comp.programming) exploring the implementation of common software
activities in different languages by requesting small working programs
as source.
Well, having thought & read about the benefits of teamwork, oss,
extreme programming etc i thought, instead of writing software that
has a known purpose - why not do the opposite, write a program the
purpose of which isn't known until it's done!
Kinda like the write a line and pass it along game of storytelling.
Now, i'm not sure if this will register as fun to anyone, or if it
will work out, but.....
I'd like some volunteers to write the functions that's aren't detailed
in the standard C program below.
I chose standard C because it's well known and cross posted to c.l.c
because clc residents can help pick out code issues, and perhaps have
some fun too - or just question the pointlessness of this exercise!
Hope this doesn't offend the purpose of clc.
Just pick one function, whatever you like, and write the function in
any way you see fit so that it will robustly fit into the simple
program below, the more imaginative it is, the more it will stretch
robustness and (hopefully) demonstrate the value of standards and
structured programming, or something..:
#include <stdio.h>
/* function definitions missing! */
int main()
{
int num1,num2,num3;
num1=GetAnInteger();
num2=GetAnInteger();
num3=DoAnOperation(num1, num2);
DisplayResult(num3);
return 0;
}
Note that anything that returns an integer must return a valid integer
whatever the size of int on the target platform. So the person who
chooses 'DoAnOperation' has an extra challenge, in designing something
interesting that produces a meaningful return (though it doesn't
*have* to be meaningful!). The other two functions might be easier,
but who knows what you may come up with.....
Regardless of the content of the functions, we should all be able to
compile any combination using the above on an iso standard compliant c
compiler and get a working program, even though we never planned what
it should do in detail!