青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

隨筆 - 18  文章 - 5  trackbacks - 0
<2025年10月>
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678

常用鏈接

留言簿

隨筆分類

隨筆檔案

文章分類

文章檔案

程序設(shè)計基礎(chǔ)

牛們

搜索

  •  

最新評論

閱讀排行榜

評論排行榜

1. An exercise on lisk
• Write a definition of LIST_ENTRY, and the insertion and deletion operations
• Write a simple line editor
Keep the entire text on a linked list, one line in a separate node. Start the program with entering LINEEDIT file, after which a prompt appears along with the line number. If the letter “I” is entered with a number n following it, then insert the text to be followed before line n. If “I” is not followed by a number, then insert the text before the current line. If “D” is entered with two numbers n and m, one n, or no number following it, then delete lines n through m, line n, or the current line. Do the same with the command, “L”, which stands for listing lines. If “A” is entered, then append the text to the existing lines. Entry “E” signifies exit and saving the text in a file.
//這道題實在做不出,參考了別的同學的…… 
#include<iostream>
#include
<fstream>
using namespace std;
ifstream fin(
"test.txt");
int cl=0;
//建立LIST_ENTRY類 
class LIST_ENTRY
{
    
public:
        
struct node
        {
            
public:
                node 
*next;
                
string s0;
                node(
string s="")
                {
                    s0
=s;
                    next
=NULL;
                }
        }
*first;
        
int l;
        LIST_ENTRY()
        {
            l
=0;
            first
=NULL;
        }
//A命令 
        int ins(string x,int y=cl+1)
        {
            
int t=y-2;
            node 
*p=first,*temp=new node(x);
            
if (t==-1)
            {
                temp
->next=first;
                first
=temp;
                l
++;
                cl
++;
                
return 1;
            }
            
if (p==NULL)
            
return 0;
            
while(t)
            {
                t
--;
                p
=p->next;
                
if(p==NULL)
                
return 0;
            }
            temp
->next=p->next;
            p
->next=temp;
            
if(y==cl+1)
            cl
++;
            
else 
            cl
=y+1;
            l
++;
            
return 1;
        }
//D命令 
        int del(int x)
        {
            node 
*p=first;
            
if (x==1)
            {
                
if (first==NULL)return 0;
                first
=first->next;
                l
--;
                delete p;
                
return 1;
            }
            
if(p==NULL)
            
return 0;
            
while (x-2)
            {
                x
--;
                p
=p->next;
                
if(p==NULL)
                
return 0;
            }
            node 
*temp=p->next;
            
if (temp!=NULL)
            {
                p
->next=temp->next;
                delete temp;
                l
--;
                
return 1;
            }
            
return 0;
        }
//E命令 
        int lis(int x,int y=0,node* p=NULL)
        {
            
if (x==1)
            p
=first;
            
if (y==1&&x==1)
            freopen(
"out.txt","w",stdout);
            
if (p==NULL)
            
return 0;
            cl
=x;
            
if (!y)
            cout
<<cl<<'>';
            cout
<<p->s0<<endl;
            
return lis(x+1,y,p->next);
        }
}a;
int chg(char* c,string &s,int &x,int &y,string &s2)
{
    
int i,j;
    s
="",s2="";
    x
=y=cl;
    
if (c[1]!=' '||(c[0]!='I'&&c[0]!='D'&&c[0]!='A'))
    {
        
for(i=0;c[i];i++)
        s
+=c[i];
        
return 0;
    }
    s
+=c[0];
    
if (c[0]=='A')
    {
        
for (i=2,j=0;c[i];i++)
        {
            
if(c[i]!=' ')j=1;
            
if(j==1)s2+=c[i];
        }
        
return 0;
    }
    
for (i=2;c[i];i++)
        
if (c[i]!=' ')
        {
            
for (j=0;c[i]!=' '&&c[i];i++)
                j
=j*10+c[i]-'0';
            y
=x=j;
            
break;
        }
    
if (c[0]!='D')
    
return 0;
    
for (;c[i];i++)
        
if (c[i]!=' ')
        {
            
for (j=0;c[i]!=' '&&c[i];i++)
            j
=j*10+c[i]-'0';
            y
=j;
            
break;
        }
    
return 0;
}
int main()
{
    
string s,s2;
    
int x,y,i=0,j=0,k=0;
    
char c[1000];
    
while(fin.getline(c,1000,10))
    {
        
for(i=0,s="";c[i];i++)
            s
+=c[i];
        a.ins(s);
    }
    cout
<<"LINEEDIT.txt"<<endl;
    a.lis(
1);
    cout
<<cl<<'>';
    
while(cin.getline(c,1000,10))
    {
        chg(c,s,i,j,s2);
        
if(s=="L")
        {
            k
=0;
            a.lis(
1);
            cout
<<cl<<'>';
            
continue;
        }
        
if(s=="A")
        {
            a.ins(s2);
            cout
<<cl<<'>';
            
continue;
        }
        
if(s=="I")
        {
            k
=2;
            cl
=i;
            cout
<<cl<<'>';
            
continue;
        }
        
if(s=="E")
        {
            k
=0;
            a.lis(
1,1);
            
return 0;
        }
        
if(s=="D")
        {
            
for(k=j;k>=i;k--)
                a.del(k);
            k
=0;
            cl
=a.l;
            cout
<<cl<<'>';
            
continue;
        }
        
if(k==2)
            a.ins(s,cl);
        cout
<<cl<<'>';
    }
    system(
"pause");
    
return 0;
}
2. An exercise on queue
• Write a queue using a doubly linked list
• Simulate a command-dispatching system
– It can accept user?s commands (from „a? – „j?)
– These commands will take 1~10s, respectively
– The user commands will be enqueued if the program can not finish the previous commands
– The program will quit if user inputs command „q?
• Hints:
– Use “_kbhit()” to determine whether user inputs a command
– Use “Sleep(1000)” to simulate the 1-second processing
• Add #include “Windows
posted on 2010-11-01 08:28 jyy 閱讀(146) 評論(0)  編輯 收藏 引用 所屬分類: OJ平臺
青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            国产精品一区二区久久久久| 亚洲视频在线观看| 久久福利毛片| 亚洲美女区一区| 免费精品视频| 国产精品系列在线播放| 久久精品国产在热久久| 亚洲精品欧美在线| 欧美一级理论片| 一区二区三区视频在线观看| 在线观看日韩精品| 好吊日精品视频| 国产精品国码视频| 欧美视频在线免费| 欧美日韩在线观看一区二区| 欧美精品日韩三级| 国产精品xxx在线观看www| 久久精品视频亚洲| 欧美在线免费视屏| 久久天堂国产精品| 亚洲国产精品久久久久婷婷老年 | 亚洲黄色尤物视频| 亚洲精品裸体| 欧美在线视频一区| 欧美国产精品中文字幕| 欧美精品一区三区| 国产一区二区久久久| 亚洲精品视频在线观看免费| 亚洲欧美卡通另类91av| 久久久久久日产精品| 亚洲丁香婷深爱综合| 亚洲天堂激情| 免费久久久一本精品久久区| 欧美色网在线| 国内免费精品永久在线视频| 1204国产成人精品视频| 宅男噜噜噜66一区二区| 久久综合五月| 亚洲小说春色综合另类电影| 久久影音先锋| 国产欧美在线观看| 国产精品99久久久久久宅男| 久久嫩草精品久久久精品一| 亚洲日本aⅴ片在线观看香蕉| 性做久久久久久久免费看| 欧美理论电影在线播放| 国外成人免费视频| 亚洲天堂av在线免费| 欧美激情精品久久久六区热门 | 亚洲自拍电影| 欧美激情久久久久| 欧美一区二区三区成人| 欧美日韩免费观看一区三区| 精品1区2区| 久久国产毛片| 亚洲视频精品在线| 亚洲日本欧美在线| 免费看精品久久片| 在线亚洲精品| 欧美日韩喷水| 亚洲蜜桃精久久久久久久| 美女日韩在线中文字幕| 欧美亚洲午夜视频在线观看| 国产精品久久久| 亚洲一区不卡| 一区二区免费在线播放| 欧美日韩美女一区二区| 艳女tv在线观看国产一区| 亚洲成人在线视频播放 | 99国产精品久久久久老师| 欧美.www| 亚洲日本中文字幕| 亚洲电影免费观看高清完整版在线 | 一区二区三区在线高清| 免费看的黄色欧美网站| 久久精品人人做人人综合| 国产区在线观看成人精品| 久久成人羞羞网站| 欧美在线一二三区| 韩日精品视频一区| 裸体素人女欧美日韩| 麻豆精品一区二区综合av| 亚洲精品国产精品乱码不99 | 黄色成人av网站| 免费在线欧美视频| 毛片基地黄久久久久久天堂| 国产色产综合产在线视频| 欧美一区二区三区成人| 午夜精品久久久久久久白皮肤| 国产欧美视频一区二区三区| 欧美一区二区三区在线| 久久精品国产一区二区三区| 亚洲成人在线| 亚洲国产高清一区二区三区| 欧美69wwwcom| 亚洲女人天堂成人av在线| 中文在线不卡视频| 国内视频精品| 最新日韩av| 欧美久久婷婷综合色| 久久精品国产第一区二区三区| 久久精品1区| 一本色道久久99精品综合| 亚洲欧洲视频| 国模套图日韩精品一区二区| 欧美成人精品高清在线播放| 欧美另类高清视频在线| 久久久精品999| 欧美精品在线一区二区三区| 激情成人综合网| 久久躁狠狠躁夜夜爽| 欧美成人资源| 午夜亚洲视频| 葵司免费一区二区三区四区五区| 亚洲视频1区| 久久久久久日产精品| 亚洲一区二区影院| 男同欧美伦乱| 久久综合九色综合网站| 国产精品成人一区| 亚洲伦理在线免费看| 91久久在线视频| 久久蜜桃香蕉精品一区二区三区| 久久av二区| 国产亚洲福利一区| 午夜国产精品视频| 欧美在线观看一区二区| 欧美视频一区二区在线观看| 91久久久在线| 一区二区激情| 欧美日韩国产黄| 亚洲精品免费看| 亚洲精选大片| 欧美精品97| 艳女tv在线观看国产一区| 在线亚洲自拍| 欧美亚洲成人精品| 一本色道久久88综合亚洲精品ⅰ| 亚洲视频国产视频| 欧美精品一区二区三区一线天视频 | 免费中文日韩| 136国产福利精品导航| 久久香蕉国产线看观看网| 黑丝一区二区三区| 国产视频在线观看一区| 欧美精品一区二区三| 亚洲欧洲一区二区在线观看 | 快播亚洲色图| 久久蜜桃香蕉精品一区二区三区| 一区二区三区导航| 欧美 亚欧 日韩视频在线| av成人免费在线| 日韩视频在线播放| 老妇喷水一区二区三区| 狂野欧美一区| 亚洲韩国日本中文字幕| 欧美一区二区三区的| 久久精品国产2020观看福利| 99国产精品99久久久久久| 亚洲国产另类 国产精品国产免费| 亚洲国产一区二区视频| 欧美色欧美亚洲另类七区| 一本色道久久综合狠狠躁篇怎么玩| 国产精品xnxxcom| 亚洲女ⅴideoshd黑人| 欧美午夜一区二区三区免费大片| 日韩午夜在线视频| aⅴ色国产欧美| 欧美日韩一区在线| 欧美尤物巨大精品爽| 久久精品国产99国产精品| 欧美视频日韩视频| 在线视频你懂得一区| 国产一区白浆| 欧美激情亚洲视频| 亚洲精品少妇网址| 亚洲一级黄色片| 国产精品入口66mio| 久久九九有精品国产23| 美女主播一区| 日韩视频精品在线观看| 欧美美女bb生活片| 久久久xxx| 亚洲国产精品视频| 亚洲小视频在线| 国内精品久久久久久| 欧美日韩国产综合新一区| 亚洲成色777777女色窝| 亚洲欧美视频在线观看视频| 欧美 日韩 国产精品免费观看| 亚洲一区在线播放| 国产一区二区三区四区在线观看| 韩国久久久久| 久久综合五月| 久久精品夜色噜噜亚洲a∨| 黄色亚洲大片免费在线观看| 免费日韩av电影| 欧美日韩一区国产| 国产精品乱码| 亚洲人体影院|