1. 程式人生 > >C Primer Plus 第六版第五章程式設計練習答案

C Primer Plus 第六版第五章程式設計練習答案

部分習題程式碼丟失,需要請聯絡博主。
編譯環境:Visual Studio 2017

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<float.h>
#include<math.h>
void lifang(double x);
void Temperatures(double a);
******************************************************************************
/* practice 1
void p5_1(void) { const int m2h=60; int min; printf("Please input minutes:\n"); scanf("%d", &min); while (min>0) { printf("equal %d hour and %d minutes\n", min/m2h, min%m2h); scanf("%d", &min); } system("pause"); } /* practice 2 void p5_2(void) { int
a,b; printf("Please input a number:\n"); scanf("%d", &a); b = a + 10; while (++a<=b) printf("%d ", a); system("pause"); } /* practice 7 void p5_7(void) { double a; printf("Please input a double numer:\n"); scanf("%lf", &a); lifang(a); system
("pause"); } void lifang(double x) { printf("%lf", pow(x,3)); } /* practice 8 void p5_8(void) { int a, b; a = 256; scanf("%d", &b); while (b!=0) { printf("%d\n", b%a); scanf("%d", &b); } system("pause"); } /* practice 9 void p5_9(void) { double a; int b; b = scanf("%lf", &a); while (b==1) { Temperatures(a); b=scanf("%lf", &a); } system("pause"); } void Temperatures(double a) { const int b = 273.15; printf("%lf\n", a); printf("%lf\n", a+b); }
2015.5.16