📄 c16.cpp
字号:
// c16.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream.h>
#include <iomanip.h>
long product( int n );
int main(int argc, char* argv[])
{
cout << "从二月份开始每月生产量为:\n";
int a = 2;
for ( int i = 2; i <= 12; i++ )
{
a = 2*a - 1;
cout << setw(2) << i << "月生产:" << setw(5) << a << endl;
}
return 0;
}
long product( int n )
{
if ( n == 1 )
return 2;
return 2 * product(n-1) - 1;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -