C Primer Plus 第6版第二章的作业

/************************************************************************/
/* practice 1 第二章作业 */
/************************************************************************/
void p2_1(void)
{
printf("John Xu\n");
printf("John\nXu\n");
printf("John");
printf(" Xu\n");
return;
}

/************************************************************************/
/* practice 2 第二章作业 */
/************************************************************************/
void p2_2(void)
{
printf("John Xu\n");
printf("address:ZHUHAI\n");
return;
}

/************************************************************************/
/* practice 3 第二章作业 */
/************************************************************************/
void p2_3(void)
{
int myAge;
int myDay;
printf("Please input your age:\n");
scanf("%d",&myAge);
myDay = myAge * 365;
printf("You've been alive for %d days",myDay);
return;
}


/************************************/
/* practice 4 第二章作业 */
/***********************************/
void jolly()
{
printf("For he's a jolly good fellow!\n");
}
void deny()
{
printf("Which nobody can deny!\n");
}
int main()
{
jolly();
jolly();
jolly();
deny();
return 0;
}

/************************************/
/* practice 5 第二章作业 */
/***********************************/

void br(void)
{
printf("Brazill,Russia");
}
void ic(void)
{
printf("India,China");
}

int main()
{
br();
printf(",");
ic();
printf("\n");
ic();
printf(",\n");
br();
return 0;
}
/************************************/
/* practice 6 第二章作业 */
/***********************************/

void p2_6()
{
int toes = 10;
int double_toes,square_toes;
double_toes = toes * 2;
square_toes = toes * toes;
printf("The int value toes is : %d\n",toes);
printf("the value of double toes is : %d\n", double_toes);
printf("the value of square toes is : %d\n", square_toes);
}
int main()
{
p2_6();
return 0;
}


/************************************/
/* practice 7 第二章作业 */
/***********************************/
void Smile()
{
printf("Smile!");
}
int main()
{
Smile();
Smile();
Smile();
printf("\n");
Smile();
Smile();
printf("\n");
Smile();
return 0;
}


/************************************/
/* practice 8 第二章作业 */
/***********************************/
void two()
{
printf("two\n");
}
void one_three()
{
printf("one\n");
two();
printf("three\n");
printf("done!");
}
int main()
{
printf("starting now:\n");
one_three();
return 0;
}

猜你喜欢

转载自www.cnblogs.com/xuxubot/p/9775999.html