doing 7.3 extra credit

This commit is contained in:
Dan Buch 2011-09-05 09:10:19 -04:00
parent 5e41db6c13
commit 67d44d78dd

12
ex6.c
View File

@ -2,16 +2,16 @@
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
int distance = 100; int distance = 0xaf + 0747;
float power = 2.345f; float power = 2.345f + 'Z' + 'A' + 'P';
double super_power = 56789.4532f; double super_power = 56789.4532f;
char initial = 'A'; char initial = 'A';
char first_name[] = "Zed"; char first_name[] = "Zed";
char last_name[] = "Shaw"; char last_name[] = {'S', 'h', 'a', 'w', '\0'};
printf("You are %d miles away.\n", distance); printf("You are %08d miles away.\n", distance);
printf("You have %f levels of power.\n", power); printf("You have %.2f levels of power.\n", power);
printf("You have %f awesome super powers.\n", super_power); printf("You have %.3f awesome super powers.\n", super_power);
printf("I have an initial %c.\n", initial); printf("I have an initial %c.\n", initial);
printf("I have a first name %s.\n", first_name); printf("I have a first name %s.\n", first_name);
printf("I have a last name %s.\n", last_name); printf("I have a last name %s.\n", last_name);