pls halp
1
Name:
Anonymous
2010-12-15 4:32
Bros. BROS. Why wont 'x' exit proper? WHERE DID I GO WRONG
[code] #include <stdio.h>
/* DINGA LINGA DOO!!! */
int derp();
main()
{
int c = 0;
int leaf = 0,rock = 0;
int i;
printf("random text.\n");
while ((c = getchar()) != EOF)
if (c == 'l')
++leaf;
else if (c == 'r')
++rock;
else if (c == 'z')
derp();
else if (c == 'x')
printf("Goodbye, world!\n");
return 0;
else
printf("leaf:%d\trock:%d\n", leaf, rock);
}
int derp()
{
printf("random text.\n");
return 0;
}[/code[
2
Name:
Anonymous
2010-12-15 4:34
shit i fail
#include <stdio.h>
/* DINGA LINGA DOO!!! */
int derp();
main()
{
int c = 0;
int leaf = 0,rock = 0;
int i;
printf("random text.\n");
while ((c = getchar()) != EOF)
if (c == 'l')
++leaf;
else if (c == 'r')
++rock;
else if (c == 'z')
derp();
else if (c == 'x')
printf("Goodbye, world!\n");
return 0;
else
printf("leaf:%d\trock:%d\n", leaf, rock);
}
int derp()
{
printf("random text.\n");
return 0;
}
3
Name:
Anonymous
2010-12-15 4:46
(Post expanded.)
4
Name:
Anonymous
2010-12-15 5:07
int derp();
Find two problems with this line.
5
Name:
Anonymous
2010-12-15 5:12
>>4
Unnecessary
int for a function that should be
void and derp.
6
Name:
Anonymous
2010-12-15 5:19
>>4,5
Also no
void between parens
7
Name:
herp
2010-12-15 6:22
derp
8
Name:
Anonymous
2010-12-15 8:29
C isn't python, you need {} to define your while block.
9
Name:
Anonymous
2010-12-15 8:38
The fuck's wrong with switch?
10
Name:
Anonymous
2010-12-15 8:39
>>1
Your program needs more semicolons. You should have at least five semicolons at the end of a
return statement and at least three after a
printf call.
11
Name:
Anonymous
2010-12-15 8:54
thx, gang
12
Name:
Anonymous
2010-12-15 9:23
You people are miserable.
13
Name:
Anonymous
2010-12-15 9:23
You people are miserable.
14
Name:
Anonymous
2010-12-15 11:53
>>12-13
Your assumption that there are "people" here was your undoing.
15
Name:
Anonymous
2010-12-15 23:02
Hey everybody! Come look at a Pythonista's shot at C!
16
Name:
Anonymous
2010-12-16 8:18
My python doesn't have a switch.
How does he jump table?
Terrible!
17
Name:
Anonymous
2010-12-16 9:16
use exit() :D
18
Name:
Anonymous
2010-12-16 12:40
:D
☻ ☹ ☹☹ ☻
19
Name:
Anonymous
2010-12-16 13:47
Why wont 'x' exit pooper?
20
Name:
Anonymous
2010-12-16 14:18
21
Name:
Anonymous
2010-12-16 15:59
☻☻☻ ☻ ☻☻☹ ☻☻ ☻ ☻☻ ☻
Welcome to Detroit!
22
Name:
Anonymous
2010-12-16 18:56
Test
23
Name:
Anonymous
2010-12-16 20:36
>>21
Marshal Mathers
is was white.
24
Name:
Anonymous
2011-02-04 12:45