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 ...
随机推荐
- ls按时间排序输出文件列表
文件转自:http://www.2cto.com/os/201303/197829.html ls按时间排序输出文件列表 首先,ls --help查看ls相关的与时间排序相关的参数: > ...
- CF464A (模拟)
http://codeforces.com/contest/465/problem/C Codeforces Round #265 (Div. 2) C Codeforces Round #265 ( ...
- jdk的安装及配置
前几天重新了下系统,所以JDK也要重新安装,顺带温故了安装及配置的过程,记录下来.(安装的版本是JDK1.7.0) 后面基本都是点下一步(i第一步选:开发工具),路径我改为E:/java/jdk 1. ...
- Apache CXF初级介绍(一)
Web Service做项目必不可少 一.CXF安装 二.用Ant来创建项目 三.用Maven来创建项目 四.用Eclipse来创建项目 五
- [译]git add
git add git add命令把工作目录下面的有修改的文件添加的index(staging)里面去. git add告诉Git你想在下次commit的时候把什么文件包含进去. 但是, git ad ...
- Linux中postfix邮件服务器的搭建
postfix是Wietse Venema在IBM的GPL协议之下开发的MTA(邮件传输代理)软件.postfix是Wietse Venema想要为使用最广泛的sendmail提供替代品的一个尝试.在 ...
- 清北暑假模拟day1 生活
/* 数字三角形,要求第K大的值,可以推知,如果得知k的范围,那么一定是在上一行可转移状态的对应范围内(反证法可以证明),这个在背包九讲里也有提及 */ #include<cstdio> ...
- #define 中#和##的作用
#的作用是把后面的参数变成一个字符串. 如,#define f(a) #a f(hello world)相当于"hello world": ##的作用是把两个字符串连接起来. 如, ...
- Android4.4 往短信收件箱中插入自定义短信(伪造短信)
这段时间稍微有点空闲,把前一段学习Android做过的一些小项目整理整理.虽然没有什么工程量很大的项目,但是对于一个新手,解决这些问题还是花了一段时间.感觉还是非常有记录的意义呢~~~么么哒*—* 今 ...
- bootstrap-scrollspy
功能:用在导航栏上,用于滚动内容时动态对应导航标签 插件:scrollspy.js 要点:scrollspy用在导航栏.导航条上居多.body添加data-spy="scroll" ...