C primer plus (6 판) 2 장의 답

16468 단어 C
C primer plus (제6 판) 제2 장 답안
2.1
#include 

int main(void) {
	printf("Gustav Mahler
"
); printf("Gustav
Mahler
"
); printf("Gustav "); printf("Mahler"); return 0; }

2.2
#include 

int main(void) {
	printf("name: joey
"
); printf("address: beijing"); return 0; }

2.3
#include 

int main(void) {
	int age2day=365*18; 
	printf(" %d days",age2day); 

	return 0;
}

2.4
#include 
void jolly(void); 
void deny(void); 
int main(void) {
	jolly();
	deny(); 
	return 0;
}

void jolly(void){
	printf("For he's a jolly good fellow!
For he's a jolly good fellow!
For he's a jolly good fellow!
"
); } void deny(void){ printf("Which nobody can deny!"); }

2.5
#include 
void br(void); 
void ic(void); 
int main(void) {
	br();
	printf(", "); 
	ic(); 
    printf("
"
); ic(); printf(",
"
); br(); } void br(void){ printf("Brazil, Russia"); } void ic(void){ printf("India, China"); }

2.6
#include 

int main(void) {
	int toes = 10 ;
	int double_toes=2*toes;
	int square_toes= toes*toes;
	 printf("toes:%d ; double_toes:%d ; square_toes:%d ;",toes,double_toes,square_toes); 
}

2.7
#include 
void smile(void); 
int main(void) {
	smile(); smile();smile();
	printf("
"
); smile();smile(); printf("
"
); smile(); } void smile(void){ printf("Smile!"); }

2.8
#include 
void one_three(void);
void two(void);
int main(void) {
	printf("starting now:
"
); one_three(); printf("done!"); return 0; } void one_three(void){ printf("one
"
); two(); printf("three
"
); } void two(void){ printf("two
"
); }

좋은 웹페이지 즐겨찾기