C Primer Plus_第三章_数据和C_复习题与编程练习
Review
Practice
1.略
2.
#include
int main(void)
{
//输入一个整数
int i;
printf("Please enter the value of i: \n");
scanf("%d",&i);
printf("i = %d\n", i);
//将这个整数赋给一个字符,自动按照ascii码找到相应的字符
char
c = i;
printf("the ASCII character of number %d is
%c\n", i, c);
return 0;
}
3.
#include
#include
#include
int main(void)
{
printf("startled by the sudden sound,\a Sally
shouted, \"By the Great Pumpkin, what was that!\"\n");
printf("\a");
return 0;
}
4.
#include
int main(void)
{
float f;
printf("Please enter a float: \n");
scanf("%f", &f);
printf("f = %f and f also = %e\n", f, f);
return 0;
}
5.
#include
int main(void)
{
int i;
double one_year = 3.156e7;
printf("My master, please enter your age:
\n");
scanf("%d",&i);
printf("My master, you have been on the earth for
about %f seconds!\n", i*one_year);
return 0;
}
7.
#include
int main(void)
{
float height;
float one_inch = 2.54;
printf("Please enter your height in centimiter my
master: \n");
scanf("%f",&height);
printf("My master, you're %1.2f cm high and that
is %1.2f inch, so cool!\n", height, height/one_inch);
return 0;
}
C Primer Plus_第三章_数据和C_复习题与编程练习的更多相关文章
- C Primer Plus_第6章_循环_编程练习
1.题略 #include int main(void) { int i; char ch[26]; for (i = 97; i <= (97+25); i++) { ch[i-97] = i ...
- C Primer Plus_第四章_字符串和格式化输入输出_编程练习
Practice 1.输入名字和姓氏,以"名字,姓氏"的格式输出打印. #include int main(void) { char name[20]; char family[2 ...
- C Primer Plus_第5章_运算符、表达式和语句_编程练习
Practice 1. 输入分钟输出对应的小时和分钟. #include #define MIN_PER_H 60 int main(void) { int mins, hours, minutes; ...
- C Primer Plus_第10章_数组和指针_编程练习
1. /*rain.c 针对若干年的降水量数据,计算年降水总量.年降水平均量,以及月降水平均量*/ #include <stdio.h> #define MONTHS 12 #define ...
- C Primer Plus_第9章_函数_编程练习
1.题略 /*返回较小值,设计驱动程序测试该函数*/ #include <stdio.h> double min (double a, double b); int main (void) ...
- C Primer Plus_第8章_字符输入输出和输入确认_编程练习
1.题略 #include <stdio.h> int main(void) { ; printf("Please enter text here(end with Ctrl + ...
- MVC5+EF6 简易版CMS(非接口) 第三章:数据存储和业务处理
目录 简易版CMS后台管理系统开发流程 MVC5+EF6 简易版CMS(非接口) 第一章:新建项目 MVC5+EF6 简易版CMS(非接口) 第二章:建数据模型 MVC5+EF6 简易版CMS(非接口 ...
- C++ primer的第三章的主要内容
第三章主要介绍了C++中标准库类型.主要讲到string和vector类型.在string类型中,能够很方便的操作字符串,应该要注意的地方就是它的字符串中元素的位置的类型是:size_type类型的数 ...
- C++ Primer 笔记 第三章
C++ Primer 第三章 标准库类型 3.1using声明 例: using namespace atd; using std::cin; 3.2string类型 初始化方式 string s1 ...
随机推荐
- Java实验2-数据库编程
目标:掌握Java数据库编程 内容: 学生选课系统包括如下数据库表 学生表:Student(Sno,Sname,Ssex,Sage,Sdept) 课程表:Course(Cno,Cname,Ccredi ...
- 连接到kali linux服务器上的MySQL服务器错误
前言:想把数据库什么的都放在虚拟机kali Linux里,但无奈出了好多错误. 首先:可以参照上一篇文章开启kali服务器端的远程连接功能,上一篇文章 然后:使用window端的sqlyog(MySQ ...
- 看开源代码利器—用Graphviz + CodeViz生成C/C++函数调用图(call graph)
一.Graphviz + CodeViz简单介绍 CodeViz是<Understanding The Linux Virtual Memory Manager>的作者 Mel Gorma ...
- linux下查找包含BOM头的文件和清除BOM头命令
查找包含BOM头的文件,命令如下: grep -r -I -l $'^\xEF\xBB\xBF' ./ 这条命令会查找当前目录及子目录下所有包含BOM头的文件,并把文件名在屏幕上输出. 但 ...
- 有利于SEO优化的DIV+CSS的命名规则小结
可以先去这里温习一下CSS和HTML的知识!DIV+CSS规范命名大全集合 CSS开发技巧整理 一.CSS文件及样式命名 1.CSS文件命名规范 全局样式:global.css/master.css ...
- ProgressBar样式(转)
普通圆形ProgressBar 该类型进度条也就是一个表示运转的过程,例如发送短信,连接网络等等,表示一个过程正在执行中. 一般只要在XML布局中定义就可以了. <progressBar and ...
- explain mysql的type字段,索引的类型
4.type这列很重要,显示了连接使用了哪种类别,有无使用索引.从最好到最差的连接类型为const.eq_reg.ref.range.indexhe和ALL (1).system这是const联接类型 ...
- C#获取当前时间与同步时间
http://blog.163.com/ljq086@126/blog/static/549639712010112921658843/ 我们可以通过使用DataTime这个类来获取当前的时间.通过 ...
- [codevs1029]遍历问题
[codevs1029]遍历问题 试题描述 我们都很熟悉二叉树的前序.中序.后序遍历,在数据结构中常提出这样的问题:已知一棵二叉树的前序和中序遍历,求它的后序遍历,相应的,已知一棵二叉树的后序遍历和中 ...
- Java 反射的应用
在学习反射之前,让我们先了解“类(Class)”.“方法”.“属性”.“类”都是名词,那么相应的在Java中会有这样一些特殊的类:“方法类(Method类)”.“属性类(Field类)”.“构造器类( ...