C Primer Plus(第六版) P37 编程答案

//1

Time:2019/4/23
writer:Hushine
#include "stdio.h"
int main()
{
	printf("Gustav Mahler\n");
	printf("Gustav\nMahler\n");
	printf("Gustav ");
	printf("Mahler\n");
	return 0;
}

//2

Time:2019/4/23
writer:Hushine
#include "stdio.h"
int main() 
{
	printf("My name is pig\n");
	printf("I live in Beijing.\n");
	return 0;
}

//3

Time:2019/4/23
writer:Hushine
#include "stdio.h"
int main()
{
	int age,days;
	printf("请输入你的年龄\n");
	scanf_s("%d",&age);
	days = age * 365;
	printf("你今年%d岁,你活了%d天",age, days);
	return 0;
}

//4

Time:2019/4/23
writer:Hushine
#include <stdio.h>
void jolly()
{
	printf("For he's jolly good fellow!\n");
}
void deny()
{
	printf("Which nobody can deny!\n");
}
int main()
{
	jolly();
	jolly();
	jolly();
	deny();
	return 0;
}

//5

Time:2019/4/23
writer:Hushine
#include "stdio.h"
void br()
{
	printf("Brazil, Russia,");
}
void ic()
{
	printf("India,China\n");
}
int main()
{
	br();
	ic();
	printf("India,China\n");
	printf("Brazil, Russia\n");
	return 0;
}

//6

#include "stdio.h"
int main()
{
	int toes=10;
	printf("toes=%d\n", toes);
	printf("2 toes=%d\n", toes * 2);
	printf("toes平方=%d\n", toes * toes);
	return 0;
}

//7

#include "stdio.h"
int main()
{
	printf("Smile!Smile!Smile!\n");
	printf("Smile!Smile!\n");
	printf("Smile!\n");
	return 0;
}

//8

#include "stdio.h"
void one_three()
{
	printf("one\n");
}
void two()
{
	printf("two\n");
}
int main()
{
	printf("Starting now:\n");
	one_three();
	two();
	printf("three\n");
	printf("down!\n");
	return 0;
}

猜你喜欢

转载自blog.csdn.net/qq_45816372/article/details/105896072