⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ch03.02.c

📁 C++ PRIME书中的原代码,看本书时可以学习的例子.
💻 C
字号:
// #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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -