标签:return img 决定 cin space std 问题 jpg 方法
#include "stdafx.h" #include<iostream> using namespace std; int fun(int m, int n) { if (n == 1) { return 0; } else { return (fun(m, n - 1) + m) % n; } } int main() { int m; int n; cout << "请按顺序输入m,n的值" << endl; cin >> m >> n; cout << "结果为:" << fun(m, n) << endl; system("pause"); return 0; }
int main() { int m, n, sum; sum = 0; cout << "请输入m,n的值" << endl; cin >> m >> n; for (int i = 1; i <=n; i++) { sum = (sum + m) % i; } cout << "结果为:"<<sum << endl; system("pause"); }
标签:return img 决定 cin space std 问题 jpg 方法
原文地址:http://www.cnblogs.com/springword/p/6075733.html