ch03.02.cpp
来自「c++ primer 经典书籍还有习题和答案,非常实用」· C++ 代码 · 共 27 行
CPP
27 行
// #include <iostream>
#include <iostream.h>
/**
** 2 raised to the power of 10: 1024
**/
int main()
{
int value = 2;
int pow = 10;
cout << value << " raised to the power of "
<< pow << ": \t";
int res = 1;
// loop control statement:
// repeat calculation of res
// until cnt is greater than pow
for ( int cnt=1; cnt <= pow; ++cnt )
res = res * value;
cout << res << endl;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?