1. 程式人生 > >C Prime Plus(第6版) 第二章答案

C Prime Plus(第6版) 第二章答案

/*前幾個太簡單了,就不贅述了(其實就是忘了存,尷尬,汗.jpg)*/


/*2.4*/
#include<stdio.h>
void jolly();
void deny();
int main()
{
	jolly();
	jolly();
	jolly();
	deny();	
}
void jolly()
{
	printf("For he's a jolly good fellow!\n");
}
void deny()
{
	printf("Which nobody can deny!\n");
}



//2.5

#include<stdio.h>
void br();
void ic();
int main()
{
	br();
	printf(",");
	ic();
	printf("\n");
	ic();
	printf(",");
	printf("\n");
	br();
	printf("\n");
}
void br()
{
	printf("Brazil,Russia");
}
void ic()
{
	printf("India,China");
}

//2.6
#include<stdio.h>
int main()
{
	int toes = 10;
	printf("%d %d %d\n",toes,2*toes,toes*toes);
}

//2.7
#include<stdio.h>
void smile();
int main()
{
	smile();smile();smile();
	printf("\n");
	smile();smile();
	printf("\n");
	smile();
	printf("\n");
}
void smile()
{
	printf("Smile!");
}
//2.8
#include<stdio.h>
void one_three();
void two();
int main()
{
	printf("String now:\n");
	one_three();
	printf("done!\n");
}
void one_three()
{
	printf("one\n");
	two();
	printf("three\n");
}
void two()
{
	printf("two\n");
}

因為比較簡單所以就不加註釋了,僅供參考思路,發現錯誤,請留言,共同進步。