1.05-变量
来源:互联网 发布:c语言求n个数的平均值 编辑:程序博客网 时间:2024/05/16 17:02
#include <stdio.h>
/*
1.变量的定义
变量类型 变量名;
int score;
2.变量的赋值
score = 100;
score = a;
score = b = 100;
3.变量的输出
int a = 200;
printf("%i", a);
常用格式符:
1> %d\%i 整数(int)
2> %f 小数(float、double)
3> %c 字符(char)
*/
int main()
{
/*
int score;
// 赋值操作(初始化)
score = 1000;
score = 10000;
char c;
c = 'A';
int a = 20;
//int d,e,f;
int b;
b = a = 40;
b = 30;*/
//变量:只要有不确定的数据,就应该定义变量来保存
int score =205;
// 1:15
int time =75;
int bestScore =3161;
// %d\%i是一个格式符(占位符),只能输出整数
printf("分数是%d\n", score);
float height =1.78f;
// %f用来输出小数,默认是6位小数
printf("身高是%.2f\n", height);
char scoreGrade ='D';
printf("积分等级是%c\n", scoreGrade);
printf("分数是%d,身高是%f,等级是%c\n", score, height, 'C');
return0;
}
- 1.05-变量
- 变量
- 变量
- 变量
- 变量
- 变量
- 变量
- 变量
- 变量
- 变量
- 变量
- 变量
- 变量
- 变量
- 变量
- 变量
- 变量
- 变量
- Adb 抓不住Genymotion的解决方法
- 1611 - Crane(贪心)
- 【日常学习】【并查集+map】codevs2639 约会计划题解
- web前端响应式布局,自适应所有分辨率
- 设计模式学习笔记十二:访问者模式
- 1.05-变量
- TestNG监听器实现失败自动截图、重跑、自定义html结果文件功能
- C 程序结构
- 1.06-变量使用注意
- Java DEMO
- 1.07-变量使用注意2
- makefile的链接顺序
- rac两节点数据库多了一组redo
- Unity3D研究院之手游开发中所有特殊的文件夹