Merge pull request #345 from xexyl/1990-theorem

This commit is contained in:
Landon Curt Noll authored and GitHub committed 2023-04-08 17:26:41 -07:00
commit 78c900bf72
4 files changed
+22 -19

No files matched your search

+2
View File
@@ -3,3 +3,5 @@ fibonacci.c
mariano mariano
sorter sorter
sorter.c sorter.c
theorem_bkp
theorem_bkp.c
+13 -7
View File
@@ -11,13 +11,19 @@ USA
make all make all
[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed some segfaults [Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed some bugs that
under modern (and in some cases earlier) systems with this entry. Originally we impacted the usability of this program including some segfaults under modern
noted that the 4 trailing args '0 0 0 0' were required on systems that dump core systems (and possibly in some cases earlier systems) with this entry.
when NULL is dereferenced but this problem showed itself in modern systems even Originally we noted that the 4 trailing args '0 0 0 0' were required on systems
with the 4 '0 0 0 0'. Finally he changed this program to use `fgets()` not that dump core when NULL is dereferenced but this problem showed itself in
`gets()` to make it safer and to prevent a warning about `gets()` at linking or modern systems even with the 4 '0 0 0 0'. He also fixed the code so that the
runtime. Thank you Cody for your assistance! generated `fibonacci.c` actually works; before it just printed `0` over and over
again (since it did not work anyway a segfault prevention was added here). He
also some array addressing (some of which might not be strictly necessary but as
he was testing the `fibonacci.c` bug he ended up changing it anyway). Finally he
changed this program to use `fgets()` not `gets()` to make it safer and to
prevent a warning about `gets()` at linking or runtime. Thank you Cody for your
assistance!
[Yusuke Endoh](/winners.html#Yusuke_Endoh) pointed out that `atof` nowadays [Yusuke Endoh](/winners.html#Yusuke_Endoh) pointed out that `atof` nowadays
needs `#include <stdlib.h>` which was used in order to get this to work needs `#include <stdlib.h>` which was used in order to get this to work
+7 -7
View File
@@ -21,7 +21,7 @@ if(R=='/')*g/=u;
if(R=='^')P(g,*g,u); if(R=='^')P(g,*g,u);
C C
w(g,R,u)float*g,u;char R; w(g,R,u)float*g,u;char R;
/**/{int b,f;A=atoi(++a);b=atoi(++a);while((f=A+b)<15000){printf("%d\n",f);A=b;b=f;}} /**/{int b,f;if(A>2){A=atoi(a[1]);b=atoi(a[2]);while((f=A+b)<15000){printf("%d\n",f);A=b;b=f;}}}
main(A,a)int A;char*a[]; main(A,a)int A;char*a[];
o o o o
if(!strcmp(*++a,"-r"))S(); if(!strcmp(*++a,"-r"))S();
@@ -46,14 +46,14 @@ W=D=1;
; ;
while(W!=1) while(W!=1)
o o o o
strcpy(j+m,v); strcpy(j[m],v);
o o
if((j-=W)<=W)break; if((j-=W)<=W)break;
strcpy(j+m,m+j-W); strcpy(j[m],m[j-W]);
C C
while(strcmp(m+j-W,v)>0) while(strcmp(m[j-W],v)>0)
j=i; j=i;
strcpy(v,i+m); strcpy(v,i[m]);
C C
for(i=(W/=3)-1;++i<n;) for(i=(W/=3)-1;++i<n;)
; ;
@@ -78,12 +78,12 @@ return O;
for(j=0;j<n;puts(j++[m])); for(j=0;j<n;puts(j++[m]));
e("",O,O,a); e("",O,O,a);
n=j-(O=1); n=j-(O=1);
while(fgets(j++[m],500,stdin)); while(fgets(j++[m],99,stdin))(j-1)[m][strlen((j-1)[m])-1]='\0';
if(!strcmp(++a,"-r"))S(); if(!strcmp(++a,"-r"))S();
C C
/**/main(A,a)int A;char*a[]; /**/main(A,a)int A;char*a[];
Y Y
S(){while(fgets(b++[m],500,stdin));for(b--;b--;puts(b[m]));} S(){while(fgets(b++[m],99,stdin))(b-1)[m][strlen((b-1)[m])-1]='\0';for(b--;b--;puts(b[m]));}
char*f,m[500][99],R,v[99]; char*f,m[500][99],R,v[99];
int b,W,n,i,j,z; int b,W,n,i,j,z;
float Q,G,D,M,T,O,B,U,V,N,e(); float Q,G,D,M,T,O,B,U,V,N,e();
-5
View File
@@ -476,11 +476,6 @@ so it should stay with this note.
this entry that prevented it from working. However if not enough args are this entry that prevented it from working. However if not enough args are
specified this program will crash. This should NOT be fixed. specified this program will crash. This should NOT be fixed.
## STATUS: known bug - please help us fix
On the other hand the `fibonacci` program that is generated prints a string of
0s over and over again. Can you fix this? See the README.md for details on how
to generate it.
# 1991 # 1991