摘要: 以向文件中读取和写入二维数组为例。以下是fprintf的使用:向文件中写入10*10的二维数组,数组元素为1~100之间的随机数。#include #includeusing namespace std;int main() { int array[13][13],i,j; FILE *fp... 阅读全文
posted @ 2015-01-19 16:49 职场亮哥 阅读(430) 评论(0) 推荐(0) 编辑
摘要: 把一个数串各个数位上的数加起来,然后用给定格式输出,这个输出很有讲究,一个大数从高位向地位输出。代码如下:#includeusing namespace std;char str[110];int res=0,flag=0;char output[15][5] = {"ling","yi","er"... 阅读全文
posted @ 2015-01-19 02:18 职场亮哥 阅读(980) 评论(0) 推荐(0) 编辑
摘要: 这是一道模拟题,大致题意就:是偶数除以2,奇数(3n+1)除以2,到1结束代码如下:#includeusing namespace std;int cnt=0;void cal(int n){ if(n==1) { cout>n) { cnt=0; cal(n); } return 0;} 阅读全文
posted @ 2015-01-19 01:43 职场亮哥 阅读(322) 评论(0) 推荐(0) 编辑