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
#include
using 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 variablefloat
fValue; //
global variableint
main(){ double
dValue; //
local variable} |
16万+

被折叠的 条评论
为什么被折叠?



