C Primer Plus(第6版)第四章答案
来源:互联网 发布:nginx 多个二级域名 编辑:程序博客网 时间:2024/05/16 12:24
1.
#include <stdio.h>int main (void){ char a[80], b[80]; printf ("Enter your first name: "); scanf ("%s", a); printf ("Enter your last name: "); scanf ("%s", b); printf ("%s, %s", b, a); return 0;}
2.
#include <stdio.h>#include <string.h>int main (void){ char a[80]; int length; printf ("Enter your name: "); scanf ("%s", a); printf ("\"%s\"\n", a); printf ("\"%20s\"\n", a); printf ("\"%-20s\"\n", a); length = strlen(a) + 3; printf ("%*s", length, a); return 0;}
3.
#include <stdio.h>int main (void){ float a; printf ("Enter a floating-number: "); scanf ("%f", &a); printf ("input is %.1f, or %.1e\n", a, a); printf ("input is %.3f, or %.3E", a, a); return 0;}
4.
#include <stdio.h>int main (void){ float height; char name[20]; printf ("Please input your height: \n"); scanf ("%f", &height); printf ("Please input your name: \n"); scanf ("%s", name); printf ("%s, you are %.3f feet of feet tall", name, height); return 0;}
5.
#include <stdio.h>int main (void){ float speed, size; printf ("Please input speed in Mb/s: \n"); scanf ("%f", &speed); printf ("Please input size in MB: \n"); scanf ("%f", &size); printf ("At %.2f megabits per second, a file of %.2f megabytes downloads in %.2f seconds.", speed, size, (size * 8) / speed); return 0;}
6.
#include <stdio.h>#include <string.h>int main (void){ char last[20], first[20]; int a, b; printf ("Please input your first name:\n"); scanf ("%s", first); printf ("Please input your last name:\n"); scanf ("%s", last); a = strlen (first); b = strlen (last); printf ("%s %s\n", first, last); printf ("%*d %*d\n", a, a, b, b); printf ("%s %s\n", first, last); printf ("%*d %*d", -a, a, -b, b); return 0;}
7.
#include <stdio.h>#include <float.h>int main (void){ double a = 1.0 / 3.0; float b = 1.0 / 3.0; printf ("%.6f, %.6f\n", a, b); printf ("%.12f, %.12f\n", a, b); printf ("%.16f, %.16f\n", a, b); printf ("%d, %d", FLT_DIG, DBL_DIG); return 0;}
8.
#include <stdio.h>#define a 3.785#define b 1.609int main (void){ float mile, gallon; printf ("Please input miles and gallons:\n"); scanf ("%f %f", &mile, &gallon); printf ("Miles per gallon: %.1f\n", mile / gallon); printf ("Litres per 100 kilometres: %.1f", gallon * a / (mile * b) * 100); return 0;}
阅读全文
0 0
- C Primer Plus(第6版)第四章答案
- C Primer Plus(第6版)第二章答案
- C Primer Plus(第6版)第三章答案
- C Primer Plus(第6版)第五章答案
- C Primer Plus(第6版)第六章答案
- C Primer Plus(第6版)第七章答案
- C Primer Plus(第6版)第八章答案
- C Primer Plus(第6版)第九章答案
- C Primer Plus(第6版)第一章答案
- c++primer plus第四版答案第十章
- c++ primer plus(第6版)中文版 第四章编程练习答案
- C++Primer Plus第6版 4.13编程练习答案
- C++ primer plus第6版第四章作业
- C++ Primer Plus第六版 第四章 编程练习答案
- C++ Primer Plus第五版 第四章 编程练习答案
- C++ Primer Plus 第四章答案哒!
- c++ primer plus第四章习题答案
- C++primer plus(第四版)第五章习题参考
- leetcode[Add Digits]//待整理多种解法
- 交叉熵
- leetcode#70. Climbing Stairs
- Python 循环终止语句
- PHP中查看PHP基本信息
- C Primer Plus(第6版)第四章答案
- 部分手机无法显示Dialog问题
- java实现俄罗斯方块
- Kotlin语法基础,函数与闭包
- WUST 1904 饥饿的牛(dp)
- Mac问题积累
- POJ 1012--Joseph
- 数据库导入数据
- Recyclerview和CheckBox的完美