|
OLD | NEW |
---|---|
(Empty) | |
1 #include <stdlib.h> | |
Brad Chen
2012/01/28 01:00:52
Copyright headers on all source files.
| |
2 #include <stdio.h> | |
3 | |
4 extern "C" | |
5 { | |
6 __attribute__((visibility("default")))const char *Magic8Ball() { | |
Brad Chen
2012/01/28 01:00:52
If you need to keep the __attribute__ stuff, maybe
noelallen1
2012/01/31 21:03:21
Done.
| |
7 const int NSIDES = 8; | |
8 const char* answer[] = { | |
9 "YES", | |
10 "NO", | |
11 "MAYBE", | |
12 "MAYBE NOT", | |
13 "DEFINITELY", | |
14 "ASK ME TOMORROW", | |
15 "PARTLY CLOUDY", | |
16 "42", | |
17 }; | |
18 | |
19 return answer[rand() % NSIDES]; | |
20 } | |
21 } | |
Brad Chen
2012/01/28 01:00:52
Not worth using the {} for extern "C" if there is
noelallen1
2012/01/31 21:03:21
Done.
| |
22 | |
OLD | NEW |