📄 exe3.cpp
字号:
// Exe3.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream.h>
int fac(int n)
{
int y;
if(n<0)
cout<<"请输入一个大于0的数!"<<endl;
else if(n==0||n==1)
y=1;
else y=fac(n-1)*n;
return y;
}
void main()
{
int n,y;
cout<<"Please input a number!"<<endl;
cin>>n;
y=fac(n);
cout<<n<<"!"<<"="<<y<<endl;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -