欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

C++順序存儲(chǔ)的線(xiàn)性表的代碼

內(nèi)容過(guò)程中中,把內(nèi)容過(guò)程中較好的內(nèi)容段做個(gè)珍藏,如下內(nèi)容段是關(guān)于C++順序存儲(chǔ)的線(xiàn)性表的內(nèi)容,希望對(duì)各位有所幫助。

創(chuàng)新互聯(lián)專(zhuān)業(yè)提供成都主機(jī)托管四川主機(jī)托管成都服務(wù)器托管四川服務(wù)器托管,支持按月付款!我們的承諾:貴族品質(zhì)、平民價(jià)格,機(jī)房位于中國(guó)電信/網(wǎng)通/移動(dòng)機(jī)房,服務(wù)器托管服務(wù)有保障!

#include <stdio.h>

#define OK 1
#define ERR 0

#define LIST_INIT_SIZE 100
#define LIST_INCREMENT 10
#define ElemType char

typedef struct {
} SqList;

{
    if(NULL == aList->elem)return ERR;
    aList->listSize = LIST_INIT_SIZE;
    aList->length = 0;
    return OK;
}

{
    int i;
    if( index<0 || index>aList->length ){
        printf("Error : Insert %c to wrong position %dn",e,index);
    }
    if( aList->listSize <= aList->length )
    {
        if(NULL == aList->elem) return ERR;
        aList->listSize += LIST_INCREMENT;
    }

    printf("Insert %c to position %dn",e,index );
    i = aList->length;
    while(i>index)
    {
        aList->elem[i] = aList->elem[i-1];
        i--;
    }

    aList->elem[index] = e;
    aList->length++;

    return OK;
}

{
    int i = index;
    if(i<0 || i>=aList->length)return ERR;

    i = index;
    while(i<aList->length-1)
    {
        aList->elem[i] = aList->elem[i+1];
        i++;
    }
    aList->length--;

    return OK;
}

int ListTraverse(SqList aList)
{
    int i=0;
    while(i < aList.length){
        printf("%ct",aList.elem[i]);
        i++;
    }
    printf("n");
    return OK;
}

{
    SqList aList ;
    char element;
    int position;

    InitList( &aList );

    while(1){
        printf("Please input element and position to insert in (input ; to quit) :n");
        scanf("%1s,%d",&element,&position);
        if(';' == element) break;
        ListInsert(&aList,element,position);
    }

    ListDelete(&aList,&element,0);

    ListTraverse(aList);

    printf("length :%d . n",aList.length);
    return OK;
}

本文名稱(chēng):C++順序存儲(chǔ)的線(xiàn)性表的代碼
轉(zhuǎn)載來(lái)源:http://www.chinadenli.net/article2/piipic.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)頁(yè)設(shè)計(jì)公司品牌網(wǎng)站制作外貿(mào)建站品牌網(wǎng)站建設(shè)做網(wǎng)站Google

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話(huà):028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

成都網(wǎng)頁(yè)設(shè)計(jì)公司