2013年3月21日
摘要: 1.识别字符串中的整数并转换为数字形式(40分)问题描述:识别输入字符串中所有的整数,统计整数个数并将这些字符串形式的整数转换为数字形式整数。要求实现函数:voidtake_num(constchar*strIn,int*n,unsignedint*outArray)【输入】strIn:输入的字符串【输出】n:统计识别出来的整数个数outArray:识别出来的整数值,其中outArray[0]是输入字符串中从左到右第一个整数,outArray[1]是第二个整数,以此类推。数组地址已经分配,可以直接使用【返回】无注:I、不考虑字符串中出现的正负号(+,-),即所有转换结果为非负整数(包括0和正整 阅读全文
posted @ 2013-03-21 13:28 mrheyao 阅读(146) 评论(1) 推荐(0) 编辑
  2013年3月20日
摘要: //判断有没有重复的数字int fun(int a[],int b[],int c[]){ for(int i=0;i<3;i++) { for(int j=0;j<3;j++) { for(int k=0;k<3;k++) { if(a[i]==b[j]||a[i]==c[k]||b[j]==c[k]) return 0; } } } return 1;}int main(){ int one,two,three; int a... 阅读全文
posted @ 2013-03-20 13:11 mrheyao 阅读(1366) 评论(1) 推荐(0) 编辑
  2013年3月18日
摘要: 本加密 的方式是将字符串中每个字符加上它在字符中的位置和一个偏移值10,以字符串“mrsoft”为例,第一个字符‘m’在字符串的位置是0,那么它对应的密文是 m+0+10#include "stdafx.h"bool jiami(char yuanwen[],int inlen,char mwen[],int outlen){ if(inlen<=0||outlen<inlen) return false; char temp; for(int i=0;i<inlen;i++) { mwen[i]=yuanwen[i]+... 阅读全文
posted @ 2013-03-18 14:43 mrheyao 阅读(254) 评论(0) 推荐(0) 编辑
  2013年3月15日
摘要: #include "stdafx.h"#include "string.h"#include "stdio.h"#include "stdlib.h"#include "conio.h"#define M 3#define N 100#define LEN 9void no_deal(int i);int score_input(int i);void average(int i);void menu();int load();void topput_();void printf_face(); 阅读全文
posted @ 2013-03-15 13:15 mrheyao 阅读(151) 评论(0) 推荐(0) 编辑
  2013年3月10日
摘要: #include "stdafx.h"#include "malloc.h"typedef struct node{ int data; struct node *next;}nnode;void initiate(nnode **head){ *head=(nnode *)malloc(sizeof(nnode)); (*head)->next=NULL;}void insert(nnode *head,int n){ nnode *p=head; nnode *s; while(p->next!=NULL) { p=p->next; 阅读全文
posted @ 2013-03-10 09:17 mrheyao 阅读(187) 评论(0) 推荐(0) 编辑
  2013年3月7日
摘要: 写一个字符串逆序的程序,时间复杂度和空间复杂度最低,效率越高越好。不知道下面的代码的时空开销几何,有更好的方法请指教。#include "stdafx.h"#include "string.h"void resere(char a[]){ int len=strlen(a); char temp; int i=0,j=len-1; while(i<len/2) { temp=a[i]; a[i++]=a[j]; a[j--]=temp; }}int main(){ char a[]={"hello world"}; resere 阅读全文
posted @ 2013-03-07 19:38 mrheyao 阅读(159) 评论(0) 推荐(0) 编辑
  2013年3月6日
摘要: 37. 每份试卷都有一个8位二进制序列号,当且仅当一个序列号含有偶数个1时,它才是有效地 。例如,0000 0000,0000 1111都是有效的,而0000 0001是无效的#include "stdafx.h"int main(){ int i,n,m=0,k; for(n=0;n<=255;n++) //8位二进制最大是255 { i=n; k=0; while(i>0) { if(i%2==1) { k++;} //计算化成二进制数后1的个数 i/=2... 阅读全文
posted @ 2013-03-06 16:50 mrheyao 阅读(441) 评论(0) 推荐(0) 编辑
摘要: 数组al[0,mid-1]和al[mid,num-1]是各自有序的,对数组al[0,num-1]的两个子有序段进行merge,得到al[0,num-1]整体有序。要求空间复杂度为O(1)。注:al[i]元素是支持'<'运算符的。下面的代码不知道有没有符合空间复杂度O(1)的要求,如有错误,望指点。#include "iostream.h"void sort(int a[],int mid,int lenght){ int temp,i,k; for(i=mid;i<=lenght;i++) { temp=a[i]; k=i-1; while(k& 阅读全文
posted @ 2013-03-06 15:10 mrheyao 阅读(176) 评论(0) 推荐(0) 编辑
  2013年3月5日
摘要: #include "stdafx.h"#include "malloc.h"typedef struct node{ int data; struct node *next;}lnode;void listinitiate(lnode **head){ *head=(lnode *)malloc(sizeof(lnode)); (*head)->next=NULL;}void listinsert(lnode *head,int n,int m){ lnode *s; lnode *p=head; int i=0; while(i<m) { 阅读全文
posted @ 2013-03-05 21:21 mrheyao 阅读(612) 评论(0) 推荐(0) 编辑
  2013年3月2日
摘要: 出自暴风影音笔试题 阅读全文
posted @ 2013-03-02 19:10 mrheyao 阅读(321) 评论(0) 推荐(0) 编辑