
C++
文章平均质量分 52
hillspring
充实奋斗每一天!
展开
-
转:华为的部分面试题
==========================本节摘抄自“海边的卡夫卡”:两道编程,一道是在一个串里面删除从i到j之间的一段,还有就是求一个数是否是对称数(付源码)。循环 除10,商除10,余数乘10, 判断结果 int print_num(int num) { int over = 0;转载 2006-11-14 13:37:00 · 1024 阅读 · 0 评论 -
常见C语言面试题之十:有序表合并
#include "stdafx.h"#include "stdio.h"#include "stdlib.h"#include "malloc.h"typedef struct LNode{ int data; LNode* next;}LNode, *LinkList;LinkList La, Lb, Lc;LNode* Create(){ LinkList l, p, q; int原创 2008-08-27 16:01:00 · 934 阅读 · 0 评论 -
常见C语言面试题之九:链表逆序
#include "stdafx.h"#include "stdio.h"#include "stdlib.h"typedef struct List{ int data; struct List *next;}List;List* list_Create(void){ List *head, *tail, *p; int e; head = (List*)malloc(sizeof(原创 2008-08-27 16:00:00 · 1397 阅读 · 0 评论 -
常见C语言面试题之八:数组实现大数阶乘
#include "stdafx.h"#include using std::cout;using std::cin;using std::endl;void factorial(int x){ int re[1000],len=1,i,carry; re[0]=1; //初始re[0]赋值1 for(int mul=2;mul//阶乘从2开始循环 for(i原创 2008-08-27 15:59:00 · 1270 阅读 · 0 评论 -
常见C语言面试题之五:两个字符串的最大公共子字符串
#include "stdafx.h"#include "stdio.h"#include "malloc.h"#include "string.h"char *maxsubstr(char *str1, char *str2){ char *p1, *p2, *q1, *q2, *destp; char *substr; int max=0, len; p1 = str1; while原创 2008-08-27 15:56:00 · 2061 阅读 · 0 评论 -
常见C语言面试题之四:删除字符串头尾空格,字符串右对齐
#include "stdafx.h"#include #include #include struct st { int id; char ch; char name[10]; double db;};char *rtrim(char *);char *ltrim(char *);char *rjust(char *);int _tmain(int argc, _TCHAR* argv[原创 2008-08-27 15:55:00 · 3344 阅读 · 0 评论 -
常见C语言面试题之三:字符串替代
#include "stdafx.h"#include "string.h"#include "malloc.h"char *replace(char *source, char *sub, char *rep){ char *result; //*pc1是复制到结果result的扫描指针 //*pc2是扫描source 的辅助指针 //*pc3寻找子串时,为检查变化中的source是否与原创 2008-08-27 15:54:00 · 991 阅读 · 0 评论 -
常见C语言面试题之二:浮点数转换为字符串
#include "stdafx.h"#include "stdlib.h"char *F2S(double d, char* str){ char str1[40]; int j=0,k,i; i = (int)d; //浮点数的整数部分 //d = d-(int)d; while(i>0) { str1[j++] = i%10+0; i /= 10; } fo原创 2008-08-27 15:53:00 · 1315 阅读 · 0 评论 -
常见C语言面试题之七:杨辉三角
int _tmain(int argc, _TCHAR* argv[]){ int i,j,a[10][10]; //i表示行,j表示列 for(i=0;i//首先将行列都赋值为0 for(j=0;j a[i][j]=0; for(i=0;i//将没一行的头尾赋值为1 { a[i][0]=1; a[i][i]=1原创 2008-08-27 15:58:00 · 1099 阅读 · 0 评论 -
常见C语言面试题之六:数组逆序
#include "stdafx.h"#include "stdio.h"#include "stdlib.h"#include "string.h"void foo1(char* a){ int len = strlen(a); for(int i=0;i { a[len] = a[i]; a[i] = a[len-i-1]; a[len-i-1] = a[len];原创 2008-08-27 15:57:00 · 1080 阅读 · 0 评论 -
常见C语言面试题之一:字符串代替、字符串转换整数
#include "stdafx.h"using namespace std;//--------字符替代问题char* Translate(char* pSrc, const char cFindChar, const char* pReplaceStr, char* pTag) { char* p = NULL ; int lLen = (in原创 2008-08-27 15:45:00 · 1122 阅读 · 0 评论 -
常见C语言面试题之十一:约瑟夫环
#include "stdafx.h"#include #include typedef struct node{ int data; struct node* next;}LNode;LNode* Create(int n, int k) //创建循环链表{ int start=k-1; if(start==0) start = n; LNode *s, *p, *L=NULL, *原创 2008-08-27 16:02:00 · 1077 阅读 · 0 评论