c/c++数学基本问题算法
文章平均质量分 79
分享自己的c/c++算法心得
LiM .YOon A
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
数据交换的函数----不解之谜
1不可以交换x和y的值#include <stdio.h>void swap(int x, int y) { int temp =x; x = y; y = temp;};int main() { int x = 1,y = 2; swap(x, y); printf("%d, %d\n", x, y); return 0;};**2可以交换x和y的值**#include <stdio.h>void swap(int &x, int &a原创 2021-05-15 17:46:41 · 452 阅读 · 0 评论 -
C/C++求阶乘
求阶乘/求 n!(n≤12),也就是1×2×3…×n挑战:尝试不使用循环语句(for、while)完成这个任务。/方法一 for循环#include<bits/stdc++.h>using namespace std;int main(){int n, sum=1;cin>>n;for(int i=1;i<=n;i++){sum=su...原创 2020-04-12 19:35:46 · 2089 阅读 · 0 评论
分享