// if x % 2 == 0, 2 divides evenly into our number
// which means it must be an even number
if (x % 2 == 0)
return true;
else
return false;
}
int main()
{
using namespace std;
cout < < "Enter a Number" << endl;
int x;
cin >> x;
if (IsEven(x))
cout < < "Even integer, returned true" << endl;
else
cout << "odd interger, returned false" << endl;
return 0;
}我使用这个教程自学C++。到目前为止很不错。我有一个关于权力的算术运算符的问题。如何做一个正方形或立方体或pentuple大量没有栏数多少次?在其他的编程语言可以使用^标志“幂”这样一个数的平方可表示为X ^ 2和pentupled数可以表示为X ^ 5。
我使用的代码::块和我尝试了很多的代码例子提供了贡献者(优秀的东西–教我负荷的什么是不该做的。..;-))和教程中的例子。
我注意到终端窗口说“过程返回0的执行时间:3.102秒(或什么)”,然而程序似乎是即时的(当然不是X秒)。..只是好奇。
黑暗王子
我electrickery =烟;-)

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



