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

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

/*3.2答案*/
#include<stdio.h>
int main()
{
	int ch;
	printf("please input one ASCII:\n");
	scanf("%d",&ch);
	printf("shuzhi: %d\n",ch);
	printf("char: %c",char(ch));
}
/*3.3答案*/
#include<stdio.h>
int main()
{
	printf("\aStartled by the sudden sound,Sally shouted,\n");
	printf("By the Great Pumpkin,what was that!");
}
/*3.4答案*/
#include<stdio.h>
int main()
{
	float ch;
	printf("Enter a floating-point value:");
	scanf("%f",&ch);
//	getchar();
	printf("fixed-point notation: %f\n",ch);
	printf("exponential notation: %e\n",ch);
	printf("p notation: %a\n",ch);
}
/*3.5 答案*/
#include<stdio.h>
const double a = 3.106e7;
int main()
{
	int old;
	printf("please input how the old of you:");
	scanf("%d",&old);
	double b = old*a;
	printf("out s:%e",b);
}

/*3.6答案*/

#include<stdio.h>
const double a = 3.0e-23;
int main()
{
	int number;
	printf("please input water number:");
	scanf("%d",&number);
	double b = (number*950)/a;
	printf("%e",b);
}