
note
go__straight
这个作者很懒,什么都没留下…
展开
-
求不大于n的阶乘和
求不大于n的阶乘和法一:#include<iostream>#include<cstdio>using namespace std;int main(){ int n,sum=0; cin >> n; for (int i = 1; i <= n; ++i) { int a = 1; for (int j = 1; j...原创 2019-04-20 17:14:11 · 249 阅读 · 0 评论 -
输入正整数n(N>2),求不大于N的全部质数
法一#include<iostream>#include<cstdio>using namespace std;int main(){ int n; cin >> n; for (int i = 2; i <= n; ++i) { int j; for ( j = 2; j < n; ++j) { if (i%...原创 2019-04-20 17:55:22 · 2389 阅读 · 0 评论 -
用freopen重定向输入
调试程序时,每次运行程序都要输入测试数据,太麻烦可以将测试数据存入文件,然后用freopen将输入由键盘重定向问文件,则运行程序时不再需要输入数据了#include<iostream>#include<cstdio>using namespace std;int main(){ FILE *stream; freopen_s(&stream,"...原创 2019-04-20 12:56:42 · 309 阅读 · 0 评论