嵌入式软件工程计划师笔试题-.doc
《嵌入式软件工程计划师笔试题-.doc》由会员分享,可在线阅读,更多相关《嵌入式软件工程计划师笔试题-.doc(35页珍藏版)》请在得力文库 - 分享文档赚钱的网站上搜索。
1、|1、将一个字符串逆序 2、将一个链表逆序 3、计算一个字节里(byte)里面有多少 bit 被置 1 4、搜索给定的字节(byte) 5、在一个字符串中找到可能的最长的子字符串 6、字符串转换为整数 7、整数转换为字符串/* 题目:将一个字符串逆序* 完成时间:2006.9.30 深圳极讯网吧* 版权归刘志强所有* 描述:写本程序的目的是希望练一下手,希望下午去面试能成功,不希望国庆节之后再去找工作拉!*/#include using namespace std;/#define NULL (void *)0)char * mystrrev(char * const dest,const c
2、har * const src)if (dest=NULL char *addr = dest;int val_len = strlen(src);destval_len = 0;int i;for (i=0; inext; while(q!=NULL) temp=q-next; q-next=p; p=q; q=temp; 这样增加个辅助的指针就行乐。ok 通过编译的代码: #include #include #include typedef struct List int data; struct List *next; List; List *list_create(void) stru
3、ct List *head,*tail,*p; int e; head=(List *)malloc(sizeof(List); tail=head; printf(“nList Create,input numbers(end of 0):“); scanf(“%d“, while(e) p=(List *)malloc(sizeof(List); p-data=e; tail-next=p; tail=p; scanf(“%d“, tail-next=NULL; return head; List *list_reverse(List *head) |List *p,*q,*r; p=he
4、ad; q=p-next; while(q!=NULL) r=q-next; q-next=p; p=q; q=r; head-next=NULL; head=p; return head; void main(void) struct List *head,*p; int d; head=list_create(); printf(“n“); for(p=head-next;p;p=p-next) printf(“-%d-“,p-data); head=list_reverse(head); printf(“n“); for(p=head;p-next;p=p-next) printf(“-
5、%d-“,p-data); 编写函数数 N 个 BYTE 的数据中有多少位是 1。解:此题按步骤解:先定位到某一个 BYTE 数据;再计算其中有多少个 1。叠加得解。#incluede#define N 10/定义 BYTE 类型别名#ifndef BYTEtypedef unsigned char BYTE;#endifint comb(BYTE b,int n)int count=0;|int bi,bj;BYTE cc=1,tt;/历遍到第 bi 个 BYTE 数据for(bi=0;bi1;tt=tt/2;return count;/测试int main()BYTE b10=3,3,3,
6、11,1,1,1,1,1,1;cout iCount) iCount = iTemp, cpDest = cpTemp;if(!*cpSource) break;+cpSource;return cpDest;#include #include / 自定义函数 MyAtoI/ 实现整数字符串转换为证书输出/ 程序不检查字符串的正确性,请用户在调用前检查/int MyAtoI(char str)int i;int weight = 1; / 权重int rtn = 0; / 用作返回for(i = strlen(str) - 1; i = 0; i-)rtn += (stri - 0)* wei
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 嵌入式 软件工程 计划 笔试
限制150内