¡¡¡¡Ë³Ðò¶ÓÁи÷ÖÖ»ù±¾ÔËËãËã·¨µÄʵÏÖ
¡¡¡¡Ë³Ðò¶ÓÁÐÊǽÏΪÆÕ±éµÄÒ»ÖÖ¶ÓÁÐʵÏÖ·½Ê½£¬²ÉÓû·×´Êý×éÀ´´æ·Å¶ÓÁÐÔªËØ£¬²¢ÓÃÁ½¸ö±äÁ¿·Ö±ðÖ¸Ïò¶ÓÁеÄǰ¶Ë(front)ºÍβ¶Ë(rear)£¬Íù¶ÓÁÐÖмӽø»òÈ¡³öÔªËØÊ±·Ö±ð¸Ä±äÕâÁ½¸ö±äÁ¿µÄ¼ÆÊý(count)¡£
¡¡¡¡¶ÓÁÐÖÐÓû·×´Êý×é´æ´¢Êý¾Ý(ºÏÀíÀûÓÿռ䡢¼õÉÙ²Ù×÷)£¬Í¨¹ý»ù±¾µÄappend()½«ÔªËؼÓÈë¶ÓÁУ¬serve()½«ÔªËØÒƳö¶ÓÁУ¬ÏȽøÈëµÄÏÈÒÆ³ö£¬retieveµÃµ½×îÏȼÓÈë¶ÓÁеÄÔªËØ¡£´ËÍâÔڼ̳еÄExtended_queue()ÖÐÎÒÔö¼ÓÁËempty()ºÍserve_and_retrieve()µÄ¹¦ÄÜ¡£

¡¡¡¡¡¾ÊµÑé˵Ã÷¡¿
¡¡¡¡ÎÒÑ¡ÔñµÄÌâÄ¿£º¿Î±¾ÖÐProgramming Projects 3.3 P1
¡¡¡¡ÎÊÌâÃèÊö£ºWrite a function that will read one line of input from the terminal. The input is supposed to consist of two parts separated by a colon ':'. As its results, your function should produce a single character as follows:
¡¡¡¡N No colon on the line.
¡¡¡¡L The left part(before the colon) is longer than the right.
¡¡¡¡R The right part(after the colon) is longer than the left.
¡¡¡¡D The left and right parts have the same length but are different.
¡¡¡¡S The left and right are exactly the same.
¡¡¡¡Examples:

¡¡¡¡Use either a queue or an extended queue to keep track of the left part of the line while reading the right part.
¡¡¡¡1.·ÖÎö¶ÓÁÐҪʵÏֵĻù±¾¹¦ÄÜÒÔ¼°¼Ì³ÐµÄÀàÒªÍØÕ¹µÄ¹¦ÄÜ´Ó¶øÈ·¶¨»ù±¾³ÉÔ±º¯Êý¡ª¡ªappend()£¬serve(),retireve()£¬ÍØÕ¹¶ÓÁÐÖУºempty()£¬serve_and_retrieve()£¬È·¶¨¶ÓÁÐÖÐÒÔ»·ÐÎÊý×é´æ´¢Êý¾Ý´Ó¶øÈ·¶¨³ÉÔ±º¯Êý¡ª¡ªQueue_entry entry[],count(¼Ç¼¶ÓÁÐÖÐÊý¾ÝÊýÁ¿)
¡¡¡¡2.±àд¶ÓÁеÄÍ·Îļþ¼°ÊµÏÖ
¡¡¡¡3.·ÖÎöÌâÄ¿ÖнáÊø³ÌÐò²¢Êä³ö¼¸ÖÖ×ÖĸµÄÌõ¼þ£¬¼òÂÔ»³ö¹¦ÄÜʵÏÖµÄÁ÷³Ìͼ£¬±àд³ÌÐò¡£(¾ßÌå˼·¼ûÔ´´úÂë×¢ÊÍ)
¡¡¡¡4.¼òµ¥²âÊÔ³ÌÐòµÄ¼¸ÖÖÇé¿ö£¬·ÖÎöÐèÒª¸Ä½øµÄµØ·½

¡¡¡¡¡¾Ïà¹Ø´úÂë¡¿
¡¡¡¡queue.h
¡¡¡¡[cpp] view plaincopyprint
¡¡¡¡#ifndef QUEUE_H
¡¡¡¡#define QUEUE_H
¡¡¡¡const int maxqueue=10;
¡¡¡¡enum Error_code {success,overflow,underflow};
¡¡¡¡typedef char Queue_entry ;
¡¡¡¡class Queue{
¡¡¡¡public:
¡¡¡¡Queue();
¡¡¡¡bool empty() const;
¡¡¡¡Error_code append(const Queue_entry &item);
¡¡¡¡Error_code serve();
¡¡¡¡Error_code retrieve(Queue_entry &item)const;
¡¡¡¡protected:
¡¡¡¡int count;
¡¡¡¡int front,rear;
¡¡¡¡Queue_entry entry[maxqueue];
¡¡¡¡};
¡¡¡¡class Extended_queue:public Queue{
¡¡¡¡public:
¡¡¡¡bool full()const;
¡¡¡¡int size()const;
¡¡¡¡void clear();