嵌入式軟件工程師筆試題

發(fā)布時(shí)間:2009-4-11 10:25    發(fā)布者:老郭
關(guān)鍵詞: 筆試 , 嵌入式 , 軟件工程師
1、將一個(gè)字符串逆序
2、將一個(gè)鏈表逆序
3、計算一個(gè)字節里(byte)里面有多少bit被置1
4、搜索給定的字節(byte)
5、在一個(gè)字符串中找到可能的最長(cháng)的子字符串
6、字符串轉換為整數
7、整數轉換為字符串


1、char *strconv(char *p)

{

    int i,length;

    char temp;

    length = strlen(p);

    for(i = 0;i < length/2;i++)

    {

        temp = *(p + i);

        *(p + i) = *(p + length - 1 - i);

        *(p +length - 1 - i) = temp;

    }

    return p;

}



int main()

{

    char src[100];

    char *p;

    scanf("%s",src);

    p = strconv(src);

    printf("%s\n",p);

    return 0;

}


3、int cal(int data) //calculation the number of bit in one byte

{

    int a;

    int count = 0;

    a = data % 100;

    while (a != 0)

    {

        count += a % 2;

        a /= 2;

    }

    return count;

}



int main()

{

    int d,count;

    scanf("%d",&d);

    count = cal(d);

    printf("%d of one\n",count);

    return 0;

}


4、#include

#include



void findmax(char *p)

{

    int j = 0,max = 0;

    int count = 0;

    char record[200];

    char recordmax[200];



    for(int i = 0;;i++)

    {

        

        if((*(p + i) == ' ') || (*(p + i) == '\0'))

        {        

            if(count > max)

            {

                max = count;

                record[j] = '\0';

                strcpy(recordmax,record);            

            }

            count = 0;

            j = 0;

        }

        else

        {

            record[j] = *(p + i);

            count ++;

            j ++;

        }

        if(*(p + i) == '\0')

            break;

    }

    printf("%s\n",recordmax);

}

            



        

int main()

{

    char str[]="zeng weidsfdsaf langd hah";

    printf("%s\n",str);

    findmax(str);

    return 0;

}
本文地址:http://selenalain.com/thread-155-1-1.html     【打印本頁(yè)】

本站部分文章為轉載或網(wǎng)友發(fā)布,目的在于傳遞和分享信息,并不代表本網(wǎng)贊同其觀(guān)點(diǎn)和對其真實(shí)性負責;文章版權歸原作者及原出處所有,如涉及作品內容、版權和其它問(wèn)題,我們將根據著(zhù)作權人的要求,第一時(shí)間更正或刪除。
您需要登錄后才可以發(fā)表評論 登錄 | 立即注冊

相關(guān)視頻

關(guān)于我們  -  服務(wù)條款  -  使用指南  -  站點(diǎn)地圖  -  友情鏈接  -  聯(lián)系我們
電子工程網(wǎng) © 版權所有   京ICP備16069177號 | 京公網(wǎng)安備11010502021702
快速回復 返回頂部 返回列表
午夜高清国产拍精品福利|亚洲色精品88色婷婷七月丁香|91久久精品无码一区|99久久国语露脸精品|动漫卡通亚洲综合专区48页