static关键字
来源:互联网 发布:java面试题2016 编辑:程序博客网 时间:2024/05/17 08:37
his is my code what i writted for the Comprehensive quiz. After i was done with it and tested that it works ( and it worked as it needed ) i checked out the solution but sawed that i do did it in an other way. I want you if you have some time that to check down the code and what do you think about it.Im totally new in this C++ programming, started with your tutorial just a few days ago but i learned java in scool so probably its recogniseable in my codeing :D .#include#includeusing namespace std;int main(){double nNumberOne = 0;double nNumberTwo = 0;char nSymbol;double nEredmeny = 0;cout <> nNumberOne ;cout <> nNumberTwo ;cout <> nSymbol;if (nSymbol == ‘+’ ){nEredmeny = nNumberOne + nNumberTwo;cout << nNumberOne <<" + " << nNumberTwo << " = " << nEredmeny;}if (nSymbol == '-' ){nEredmeny = nNumberOne – nNumberTwo;cout << nNumberOne <<" – " << nNumberTwo << " = " << nEredmeny;}if (nSymbol == '*' ){nEredmeny = nNumberOne * nNumberTwo;cout << nNumberOne <<" * " << nNumberTwo << " = " << nEredmeny;}if (nSymbol == '/'){nEredmeny = nNumberOne / nNumberTwo;cout << nNumberOne <<" / " << nNumberTwo << " = " << nEredmeny;
在前人的经验教训,你了解了局部变量(有块范围)和全局变量(有计划的范围)。还有另一个作用域的变量,可以水平:文件范围。
文件范围内的变量可以被访问的任何功能或嵌在一个单一的文件。申报文件作用域的变量,简单地声明一个变量,一块外(同一个全局变量)但使用static关键字:
1
2
3
4
5
6
7
static
int
nValue;
// file scoped variable
float
fValue;
// global variable
int
main()
{
double
dValue;
// local variable
}
0 0
- static关键字
- static关键字
- 关键字STATIC
- 关键字STATIC
- static关键字
- static 关键字
- static关键字
- static关键字
- static关键字
- static关键字
- static 关键字
- Static 关键字
- static关键字
- Static关键字
- static关键字
- static关键字
- static关键字
- 关键字:static
- 值x和y的屏幕
- RELOOP RMP-3阿尔法
- 在一本教科书的页数
- Presto:Facebook的分布式SQL查询引擎
- Sonos的是最有效的无线歌曲节目
- static关键字
- 倒序的拓扑排序
- hdu1181(变形课)-并查集
- MP3播放器FM发射器车调制器是USB SD MMC卡
- 展现出能看见俺华工科技按时回国科技阿黑哥空间
- C++ 虚函数表解析
- Python学习22:列表解析(列表综合深入)
- 差异的最简单
- P168e 3.5英寸触摸屏中国移动手机