programming-challenges

B

Barry

Ajinkya said:
Me along with some of my friends have formed a programming group on
google to discuss programming
problem approaches....
Do join it will be helpful to all beginners and experts same.

Here is the link to it :
http://groups.google.co.in/group/programming-challenges


Ciao,
Ajinkya.

Judging by the couple of discussions I looked at on your site,
you have never read c.l.c. Better to shut it down than to
propogate such bad ideas.
 
K

Kenny McCormack

Judging by the couple of discussions I looked at on your site,
you have never read c.l.c. Better to shut it down than to
propogate such bad ideas.

It is probably not possible for him to shut down clc. Usenet being what
it is.

But I agree about it (clc) propogating (lots of) bad ideas. Not much
you can do about it, though.
 
A

Ajinkya

Judging by the couple of discussions I looked at on your site,
you have never read c.l.c. Better to shut it down than to
propogate such bad ideas.

Please dont say that to me....there are ACM ICPC winners on the group
who post regularly.
I think they have not read clc(thats what you meant?) what say?

Ciao,
Ajinkya.
 
A

Ajinkya

Judging by the couple of discussions I looked at on your site,
you have never read c.l.c. Better to shut it down than to
propogate such bad ideas.

Please specify what you found as a "bad idea".....

Ajinkya.
 
R

Richard Heathfield

Ajinkya said:
Please dont say that to me....there are ACM ICPC winners on the group
who post regularly.

If they're that good, why doesn't their code compile and work properly?

First example I found:

#include <stdio.h>
#include <conio.h>


int main()
{
int TotalSteps=0,NoOfTwoSteps,NoOfOneSteps,TotalWays=1;
int i;


printf ("\nPlease enter the number of steps: ");
scanf ("%d",&TotalSteps);


NoOfTwoSteps=TotalSteps/2;


for (i=1;i<=NoOfTwoSteps;i++)
{
int Factorial1,Factorial2,Factorial3;
int TotalStep,j;
NoOfOneSteps = TotalSteps - i * 2;


Factorial1=Factorial2=Factorial3=1;


for (j=2;j<=NoOfOneSteps+i;j++)
Factorial1*=j;


for (j=2;j<=NoOfOneSteps;j++)
Factorial2*=j;


for (j=2;j<=i;j++)
Factorial3*=j;


TotalStep = Factorial1/(Factorial2*Factorial3);
TotalWays+=TotalStep;
}


printf("\nTotal Ways are: %d",TotalWays);


getch();
return 0;

When we compile this, we get:

foo.c:2: conio.h: No such file or directory
make: *** [foo.o] Error 1

Removing that line, we get:

foo.c:4: warning: function declaration isn't a prototype
foo.c: In function `main':
foo.c:46: warning: implicit declaration of function `getch'
foo.c:49: parse error at end of input
make: *** [foo.o] Error 1

When we remove the getch and fix the missing brace, we get a program
which behaves thusly:

me@here> ./foo

Please enter the number of steps: ELEPHANT

Total Ways are: 1me@here>

Not good.
 
A

Ajinkya

Ajinkya said:
Please dont say that to me....there are ACM ICPC winners on the group
who post regularly.

If they're that good, why doesn't their code compile and work properly?

First example I found:

#include <stdio.h>
#include <conio.h>

int main()
{
int TotalSteps=0,NoOfTwoSteps,NoOfOneSteps,TotalWays=1;
int i;

printf ("\nPlease enter the number of steps: ");
scanf ("%d",&TotalSteps);

NoOfTwoSteps=TotalSteps/2;

for (i=1;i<=NoOfTwoSteps;i++)
{
int Factorial1,Factorial2,Factorial3;
int TotalStep,j;
NoOfOneSteps = TotalSteps - i * 2;

Factorial1=Factorial2=Factorial3=1;

for (j=2;j<=NoOfOneSteps+i;j++)
Factorial1*=j;

for (j=2;j<=NoOfOneSteps;j++)
Factorial2*=j;

for (j=2;j<=i;j++)
Factorial3*=j;

TotalStep = Factorial1/(Factorial2*Factorial3);
TotalWays+=TotalStep;
}

printf("\nTotal Ways are: %d",TotalWays);

getch();
return 0;

When we compile this, we get:

foo.c:2: conio.h: No such file or directory
make: *** [foo.o] Error 1

Removing that line, we get:

foo.c:4: warning: function declaration isn't a prototype
foo.c: In function `main':
foo.c:46: warning: implicit declaration of function `getch'
foo.c:49: parse error at end of input
make: *** [foo.o] Error 1

When we remove the getch and fix the missing brace, we get a program
which behaves thusly:

me@here> ./foo

Please enter the number of steps: ELEPHANT

Total Ways are: 1me@here>

Not good.

uh?....we dont discuss codes there....the code was just to support the
algorithm used. And i know "conio.h" is not in ANSI standards....but
as the program was compiled in turboC it worked out there....it will
definetely not work on unix systems as "conio.h" cannot be used in gcc
as gcc is accord to ANSI....thanks i will see to it that ppl will not
use that further(but i cant stop them from doing it....we can only
comment)

Ciao,
Ajinkya.
 
R

Richard Heathfield

Ajinkya said:
uh?....we dont discuss codes there....the code was just to support the
algorithm used. And i know "conio.h" is not in ANSI standards....but
as the program was compiled in turboC it worked out there....

Oh, I see - so your site is for Turbo C users only? Thank you - I'll
make a note.
 
A

ak

Ajinkya said:







Oh, I see - so your site is for Turbo C users only? Thank you - I'll
make a note.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999http://www.cpax.org.uk
email: rjh at the above domain, - www.- Hide quoted text -

- Show quoted text -

Not at all.....but i cant stop people from using TurboC
 
B

Bart van Ingen Schenau

ak said:
Not at all.....but i cant stop people from using TurboC

That's true, but you can stop people from posting code that works *only*
on Turbo C.

In a group that is not specifically focussed on using one particular
compiler, the contributers should make an effort that the programs they
provide can be used on any compiler that the readers might use.
If you restrict yourself to the features provided by the ANSI/ISO C
standard, that will be automatically the case.

Bart v Ingen Schenau
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top