第1题
#include <stdio.h>
int main(void)
{
printf("Gustav Mahler\n");
printf("Gustav\nMahler\n");
printf("Gustav ");
printf("Mahler\n");
return 0;
}
第2题
#include <stdio.h>
int main(void)
{
printf("Name: ******\n");
printf("Address: ******\n");
return 0;
第3题
#include <stdio.h>
int main(void)
{
int ageyears;
int agedays;
ageyears = 101;
agedays = 365 * ageyears;
printf("An age of %d years is %d days.\n", ageyears, agedays);
return 0;
}
第4题
#include <stdio.h>
void jolly(void);
void deny(void);
int main(void)
{
jolly();
jolly();
jolly();
deny();
return 0;
}
void jolly(void)
{
printf("For he's a jolly good fellow!\n");
}
void deny(void)
{
printf("Which nobody can deny!\n");
}
第5题
#include <stdio.h>
void br(void);
void ic(void);
int main(void)
{
br();
printf(", ");
ic();
printf("\n");
ic();
printf(",\n");
br();
printf("\n");
return 0;
}
void br(void)
{
printf("Brazil, Russia");
}
void ic(void)
{
printf("India, China");
}
第6题
#include <stdio.h>
int main(void)
{
int toes;
toes = 10;
printf("toes = %d\n", toes);
printf("Twice toes = %d\n", 2 * toes);
printf("toes squared = %d\n", toes * toes);
return 0;
}
第7题
#include <stdio.h>
void smile(void);
int main(void)
{
smile();
smile();
smile();
printf("\n");
smile();
smile();
printf("\n");
smile();
return 0;
}
void smile(void)
{
printf("Smile!");
}
第8题
#include <stdio.h>
void one_three(void);
void two(void);
int main(void)
{
printf("starting now:\n");
one_three();
printf("done!\n");
return 0;
}
void one_three(void)
{
printf("one\n");
two();
printf("three\n");
}
void two(void)
{
printf("two\n");
}