2011-09-06 00:50:39 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
int bugs = 100;
|
|
|
|
double bug_rate = 1.2;
|
|
|
|
|
|
|
|
printf("You have %d bugs imaginary rate of %f.\n",
|
|
|
|
bugs, bug_rate);
|
|
|
|
|
2011-09-08 19:57:49 +00:00
|
|
|
unsigned long universe_of_defects = 63.99999999999 * 32 * 1024 * 1024;
|
2011-09-06 00:50:39 +00:00
|
|
|
printf("The entire universe has %ld bugs.\n",
|
|
|
|
universe_of_defects);
|
|
|
|
|
|
|
|
double expected_bugs = bugs * bug_rate;
|
|
|
|
printf("You are expected to have %f bugs.\n",
|
|
|
|
expected_bugs);
|
|
|
|
|
|
|
|
double part_of_universe = expected_bugs / universe_of_defects;
|
|
|
|
printf("That is only a %e portion of the universe.\n",
|
|
|
|
part_of_universe);
|
|
|
|
|
|
|
|
|
|
|
|
char nul_byte = '\0';
|
|
|
|
int care_percentage = bugs * nul_byte;
|
|
|
|
printf("Which means you should care %d%%.\n",
|
|
|
|
care_percentage);
|
|
|
|
|
2011-09-06 01:03:40 +00:00
|
|
|
puts("also...");
|
|
|
|
int nul = (int)nul_byte;
|
|
|
|
int *nul_ptr = &nul;
|
|
|
|
printf("char '\\0' = '%c', (int)'\\0' = '%d', &(int)'\\0' = '%n'.\n",
|
|
|
|
nul_byte, nul, nul_ptr);
|
|
|
|
|
2011-09-06 00:50:39 +00:00
|
|
|
return 0;
|
|
|
|
}
|