Difference between revisions of "explain xkcd:Sandbox"
ConwayGlider (talk | contribs) (Why is my edit reverted?) |
|||
| Line 11: | Line 11: | ||
<td class="{{{class|}}}" style="line-height: 1.3em;">Unknown</td></tr></table> | <td class="{{{class|}}}" style="line-height: 1.3em;">Unknown</td></tr></table> | ||
| β | < | + | <pre>#include <cstdio> |
| + | int a[3]={0,0,0}; | ||
| + | void acase(int b){ | ||
| + | if(b>=0)printf("case %d:",b); | ||
| + | } | ||
| + | void dcase(int d,int m=0){ | ||
| + | printf("\t\t\t\t");m?printf(" "):0;acase(a[0]+d);acase(a[1]+d);acase(a[2]+d);m?printf("\n"):printf("printf(\"2$\");break;\n"); | ||
| + | } | ||
| + | int main() { | ||
| + | dcase(9,1); | ||
| + | dcase(0); | ||
| + | dcase(10,1); | ||
| + | dcase(1); | ||
| + | dcase(2,1); | ||
| + | dcase(3,1); | ||
| + | dcase(6,1); | ||
| + | dcase(7,1); | ||
| + | dcase(11,1); | ||
| + | dcase(12,1); | ||
| + | dcase(17,1); | ||
| + | dcase(18); | ||
| + | dcase(14,1); | ||
| + | dcase(4); | ||
| + | dcase(15,1); | ||
| + | dcase(5); | ||
| + | dcase(8); | ||
| + | dcase(13); | ||
| + | dcase(19); | ||
| + | dcase(16,1); | ||
| + | dcase(20); | ||
| + | return 0; | ||
| + | }</pre> | ||
Revision as of 09:51, 26 February 2023
Make changes, try things out, or just have fun with the wiki here! Just leave everything above the line alone, please. clear sandbox
| b | |
|---|---|
| Born | Unknown |
#include <cstdio>
int a[3]={0,0,0};
void acase(int b){
if(b>=0)printf("case %d:",b);
}
void dcase(int d,int m=0){
printf("\t\t\t\t");m?printf(" "):0;acase(a[0]+d);acase(a[1]+d);acase(a[2]+d);m?printf("\n"):printf("printf(\"2$\");break;\n");
}
int main() {
dcase(9,1);
dcase(0);
dcase(10,1);
dcase(1);
dcase(2,1);
dcase(3,1);
dcase(6,1);
dcase(7,1);
dcase(11,1);
dcase(12,1);
dcase(17,1);
dcase(18);
dcase(14,1);
dcase(4);
dcase(15,1);
dcase(5);
dcase(8);
dcase(13);
dcase(19);
dcase(16,1);
dcase(20);
return 0;
}
