亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? 13.cpp

?? 《數據結構與程序設計》書本所有源代碼!!!!
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
/* Program extracts from Chapter 13 of   "Data Structures and Program Design in C++"   by Robert L. Kruse and Alexander J. Ryba   Copyright (C) 1999 by Prentice-Hall, Inc.  All rights reserved.   Extracts from this file may be used in the construction of other programs,   but this code will not compile or execute as given here. */// Section 13.3:Error_code Expression::evaluate_prefix(Value &result)/*  Outline of a method to perform prefix evaluation of an Expression.    The details depend on further decisions about the implementation of    expressions and values.*/{   if (the Expression is empty) return fail;   else {      remove the first symbol from the Expression, and         store the value of the symbol as t;      if (t is a unary operation) {        Value the_argument;        if (evaluate_prefix(the_argument) == fail) return fail;        else result = the value of operation t applied to the_argument;      }      else if (t is a binary operation) {        Value first_argument, second_argument;        if (evaluate_prefix(first_argument) == fail) return fail;        if (evaluate_prefix(second_argument) == fail) return fail;        result  = the value of operation t                      applied to first_argument and second_argument;      }      else              //  t is a numerical operand.        result = the value of t;   }   return success;}class Expression {public:   Error_code evaluate_prefix(Value &result);   Error_code get_token(Token &result);   //  Add other methods.private:   //  Add data members to store an expression.};enum Token_type {   operand, unaryop, binaryop    //  Add any other legitimate token types.};Value do_unary(const Token &operation, const Value &the_argument);Value do_binary(const Token &operation,                const Value &first_argument, const Value &second_argument);Value get_value(const Token &operand);Error_code Expression::evaluate_prefix(Value &result)/*Post: If the Expression does not begin with a legal prefix expression, a code      of fail is returned.  Otherwise a code of success is returned, and      the Expression is evaluated, giving the Value result.  The initial      tokens that are evaluated are removed from the Expression.*/{   Token t;   Value the_argument, first_argument, second_argument;   if (get_token(t) == fail) return fail;   switch (t.kind()) {   case unaryop:      if (evaluate_prefix(the_argument) == fail) return fail;      else result = do_unary(t, the_argument);      break;   case binaryop:      if (evaluate_prefix(first_argument) == fail) return fail;      if (evaluate_prefix(second_argument) == fail) return fail;      else result = do_binary(t, first_argument, second_argument);      break;   case operand:      result = get_value(t);      break;   }   return success;}typedef Value Stack_entry;   //  Set the type of entry to use in stacks.Error_code Expression::evaluate_postfix(Value &result)/*Post: The tokens in Expression up to the first end_expression symbol are      removed.  If these tokens do not represent a legal postfix expression, a      code of fail is returned.   Otherwise a code of success is returned,      and the removed sequence of tokens is evaluated to give Value result.*/{   Token t;             //  Current operator or operand   Stack operands;      //  Holds values until operators are seen   Value the_argument, first_argument, second_argument;   do {      if (get_token(t) == fail) return fail;   //  No end_expression token      switch (t.kind()) {      case unaryop:         if (operands.empty()) return fail;         operands.top(the_argument);         operands.pop();         operands.push(do_unary(t, the_argument));         break;      case binaryop:         if (operands.empty()) return fail;         operands.top(second_argument);         operands.pop();         if (operands.empty()) return fail;         operands.top(first_argument);         operands.pop();         operands.push(do_binary(t, first_argument, second_argument));         break;      case operand:         operands.push(get_value(t));         break;      case end_expression:         break;      }   } while (t.kind() != end_expression);   if (operands.empty()) return fail;   operands.top(result);   operands.pop();   if (!operands.empty()) return fail;  //  surplus operands detected   return success;}Error_code Expression::evaluate_postfix(Value &result)/*Post: The tokens in Expression up to the first end_expression symbol are      removed.  If these tokens do not represent a legal postfix expression, a      code of fail is returned.   Otherwise a code of success is returned,      and the removed sequence of tokens is evaluated to give Value result.*/{   Token first_token, final_token;   Error_code outcome;   if (get_token(first_token) == fail || first_token.kind() != operand)      outcome = fail;   else {      outcome = recursive_evaluate(first_token, result, final_token);      if (outcome == success && final_token.kind() != end_expression)         outcome = fail;   }   return outcome;}Error_code Expression::recursive_evaluate(const Token &first_token,                                          Value &result, Token &final_token)/*Pre:  Token first_token is an operand.Post: If the first_token can be combined with initial tokens of      the Expression to yield a legal postfix expression followed      by either an end_expression symbol or a binary operator,      a code of success is returned, the legal postfix subexpression      is evaluated, recorded in result, and the terminating Token is      recorded as final_token.  Otherwise a code of fail is returned.      The initial tokens of Expression are removed.Uses: Methods of classes Token and Expression, including      recursive_evaluate and functions do_unary, do_binary,      and get_value.*/{   Value first_segment = get_value(first_token),         next_segment;   Error_code outcome;   Token current_token;   Token_type current_type;   do {      outcome = get_token(current_token);      if (outcome != fail) {         switch (current_type = current_token.kind()) {         case binaryop:          //  Binary operations terminate subexpressions.         case end_expression:    //  Treat subexpression terminators together.            result = first_segment;            final_token = current_token;            break;         case unaryop:            first_segment = do_unary(current_token, first_segment);            break;         case operand:            outcome = recursive_evaluate(current_token,                                         next_segment, final_token);            if (outcome == success && final_token.kind() != binaryop)               outcome = fail;            else               first_segment = do_binary(final_token, first_segment,                                         next_segment);            break;         }      }   } while (outcome == success && current_type != end_expression &&                                  current_type != binaryop);   return outcome;}// Section 13.4:Expression Expression::infix_to_postfix()/*Pre:  The Expression stores a valid infix expression.Post: A postfix expression that translates the infix expression is returned.*/{   Expression answer;   Token current, prior;   Stack delayed_operations;   while (get_token(current) != fail) {      switch (current.kind()) {      case operand:         answer.put_token(current);         break;      case leftparen:         delayed_operations.push(current);         break;      case rightparen:         delayed_operations.top(prior);         while (prior.kind() != leftparen) {            answer.put_token(prior);            delayed_operations.pop();            delayed_operations.top(prior);         }         delayed_operations.pop();         break;      case unaryop:      case binaryop:               //  Treat all operators together.         bool end_right = false;   //  End of right operand reached?         do {            if (delayed_operations.empty()) end_right = true;            else {               delayed_operations.top(prior);               if (prior.kind() == leftparen) end_right = true;               else if (prior.priority() < current.priority()) end_right = true;               else if (current.priority() == 6) end_right = true;               else answer.put_token(prior);               if (!end_right) delayed_operations.pop();            }         } while (!end_right);         delayed_operations.push(current);         break;      }   }   while (!delayed_operations.empty()) {      delayed_operations.top(prior);      answer.put_token(prior);      delayed_operations.pop();   }   answer.put_token(";");   return answer;}// Section 13.5:int main()/*Pre:  NonePost: Acts as a menu-driven graphing program.Uses: Classes Expression and Plot,      and functions introduction, get_command,      and do_command.*/{   introduction();   Expression infix;      //  Infix expression from user   Expression postfix;    //  Postfix translation   Plot graph;   char ch;   while ((ch = get_command()) != 'q')      do_command(ch, infix, postfix, graph);}void do_command(char c, Expression &infix, Expression &postfix, Plot &graph)/*Pre:  NonePost: Performs the user command represented by char c on the      Expression infix, the Expression postfix, and the Plot graph.Uses: Classes Token, Expression and Plot.*/{   switch (c) {   case 'r':      //  Read an infix expression from the user.      infix.clear();      infix.read();      if (infix.valid_infix() == success) postfix = infix.infix_to_postfix();      else cout << "Warning: Bad expression ignored. " << endl;      break;   case 'w':      //  Write the current expression.      infix.write();      postfix.write();      break;   case 'g':      //  Graph the current postfix expression.      if (postfix.size() <= 0)         cout << "Enter a valid expression before graphing!" << endl;      else {         graph.clear();         graph.find_points(postfix);         graph.draw();      }      break;   case 'l':    //  Set the graph limits.      if (graph.set_limits() != success)         cout << "Warning: Invalid limits" << endl;      break;   case 'p':    //  Print the graph parameters.      Token::print_parameters();      break;   case 'n':    //  Set new graph parameters.      Token::set_parameters();      break;   case 'h':    //  Give help to user.      help();      break;   }}struct Token_record {   String name;   double value;   int priority;   Token_type kind;};struct Lexicon {   Lexicon();   int hash(const String &x) const;   void set_standard_tokens();  //  Set up the predefined tokens.   int count;                   //  Number of records in the Lexicon   int index_code[hash_size];   //  Declare the hash table.   Token_record token_data[hash_size];};class Token {public://  Add methods here.private:   int code;   static Lexicon symbol_table;   static List<int> parameters;};List<int> Token::parameters;   //  Allocate storage for static Token members.Lexicon Token::symbol_table;class Expression {public://  Add method prototypes.private:   List<Token> terms;   int current_term;//  Add auxiliary function prototypes.};class Token {public:   Token() {}   Token (const String &x);   Token_type kind() const;   int priority() const;   double value() const;   String name() const;   int code_number() const;   static void set_parameters();   static void print_parameters();   static void set_x(double x_val);private:   int code;   static Lexicon symbol_table;   static List<int> parameters;};Token_type Token::kind() const{

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲精品中文字幕乱码三区| 国产亚洲成av人在线观看导航| 夜夜精品视频一区二区| 色哟哟一区二区在线观看 | 久久狠狠亚洲综合| 宅男在线国产精品| 精品在线播放午夜| 中文一区在线播放| 欧美在线观看视频一区二区三区 | 天堂成人国产精品一区| 欧美一区二区三区色| 国产真实精品久久二三区| 国产日韩v精品一区二区| eeuss鲁片一区二区三区| 一二三四社区欧美黄| 日韩欧美黄色影院| 99在线视频精品| 日韩电影在线看| 久久精品一二三| 色综合久久中文字幕综合网| 日韩精品久久理论片| 国产欧美一区二区三区鸳鸯浴| 一本一道久久a久久精品综合蜜臀 一本一道综合狠狠老 | 国产在线不卡一区| 欧美高清在线一区二区| 欧美性一二三区| 国产老肥熟一区二区三区| 中文字幕一区免费在线观看| 宅男在线国产精品| 99视频精品免费视频| 久久精品国产亚洲一区二区三区| 国产精品动漫网站| 精品国内片67194| 欧美亚洲免费在线一区| 粉嫩一区二区三区在线看| 日韩在线观看一区二区| 亚洲色图欧美偷拍| 精品av久久707| 欧美视频一区二区三区四区| 成人在线综合网| 日韩中文字幕91| 亚洲伦在线观看| 国产亚洲一区字幕| 日韩欧美123| 欧美性生活大片视频| 不卡一区中文字幕| 国产麻豆一精品一av一免费 | 国产精品全国免费观看高清| 日韩欧美国产电影| 欧美裸体bbwbbwbbw| 91最新地址在线播放| 国产剧情一区二区| 日韩一区精品字幕| 亚洲成人先锋电影| 亚洲激情av在线| 亚洲欧洲精品成人久久奇米网| 久久久影院官网| 日韩视频在线永久播放| 欧美午夜一区二区| 91免费视频观看| 99久久99久久综合| av一二三不卡影片| 成人三级在线视频| 国产91综合网| 成人午夜精品在线| 成人丝袜18视频在线观看| 国产精品系列在线播放| 国产一区视频导航| 国产一区二区三区最好精华液| 三级影片在线观看欧美日韩一区二区 | 91麻豆精品在线观看| 成人性色生活片| 成人激情校园春色| 成人动漫一区二区在线| 不卡的av在线| 色哟哟在线观看一区二区三区| 91麻豆视频网站| 色欧美88888久久久久久影院| 日本福利一区二区| 欧美网站大全在线观看| 欧美日韩大陆一区二区| 欧美精选一区二区| 91精品国产免费久久综合| 日韩欧美你懂的| 久久精品视频免费观看| 欧美国产视频在线| 亚洲美女淫视频| 午夜天堂影视香蕉久久| 久久精品国产精品青草| 国内不卡的二区三区中文字幕| 国产精品亚洲第一区在线暖暖韩国 | 岛国精品一区二区| 99视频精品全部免费在线| 色哟哟一区二区三区| 欧美精品乱码久久久久久| 日韩欧美一级二级三级| 欧美高清一级片在线观看| 国产精品国产三级国产| 亚洲成a人片综合在线| 日本成人在线不卡视频| 国产91综合网| 欧美视频一区二| 久久久影视传媒| 一区二区三区中文字幕电影 | 久久一区二区三区四区| 国产精品免费看片| 图片区小说区区亚洲影院| 精品一区二区三区影院在线午夜| 国产成a人亚洲| 在线视频一区二区三区| 精品欧美乱码久久久久久| 中文字幕人成不卡一区| 裸体在线国模精品偷拍| 成人永久aaa| 欧美一区二区三区啪啪| 国产精品久久毛片av大全日韩| 亚洲一区二区三区不卡国产欧美 | 国产精品免费av| 亚洲成人免费视| 国产宾馆实践打屁股91| 欧美日韩一级片在线观看| 久久精品视频一区| 天堂va蜜桃一区二区三区漫画版| 国产99久久久精品| 欧美一区二区三区四区五区 | 老司机一区二区| 色视频成人在线观看免| 久久综合成人精品亚洲另类欧美 | eeuss鲁片一区二区三区在线看| 欧美精品久久久久久久多人混战| 国产日产欧美一区二区三区| 五月天欧美精品| www.成人在线| 久久先锋影音av鲁色资源| 香蕉乱码成人久久天堂爱免费| 国产成人免费高清| 欧美xxxx在线观看| 亚洲第一二三四区| 日本韩国欧美一区| 国产精品欧美精品| 国产精品自拍网站| 日韩一级黄色大片| 亚洲国产精品一区二区久久| 91网站黄www| 国产精品国产三级国产普通话三级| 另类小说视频一区二区| 欧美精选一区二区| 亚洲国产视频网站| 91在线观看高清| 国产日韩欧美精品在线| 国产在线精品一区二区三区不卡| 欧美色男人天堂| 亚洲精品国产a| 色偷偷成人一区二区三区91| 中文字幕一区在线| 日韩欧美一区中文| 麻豆精品视频在线| 欧美一级国产精品| 美洲天堂一区二卡三卡四卡视频| 欧美高清视频一二三区 | 日韩高清在线观看| 欧美女孩性生活视频| 午夜视频在线观看一区二区三区| 欧美优质美女网站| 亚洲成人动漫精品| 欧美日韩国产精品自在自线| 午夜精品影院在线观看| 7777女厕盗摄久久久| 日本va欧美va欧美va精品| 欧美精品高清视频| 毛片av一区二区| 欧美不卡一区二区| 国内国产精品久久| 久久人人97超碰com| 国产69精品久久99不卡| 国产精品久久三| 91国在线观看| 亚洲午夜在线观看视频在线| 欧美一区永久视频免费观看| 久久电影网站中文字幕| 欧美韩国日本一区| 91丝袜美女网| 香蕉久久一区二区不卡无毒影院 | 91国偷自产一区二区开放时间| 亚洲免费在线看| 91麻豆精品久久久久蜜臀| 免费观看成人av| 日本一区二区免费在线| 91偷拍与自偷拍精品| 亚洲在线一区二区三区| 欧美一级理论片| 成人手机电影网| 亚洲专区一二三| 日韩精品专区在线影院重磅| 懂色av一区二区夜夜嗨| 夜夜爽夜夜爽精品视频| 欧美不卡123| 91女神在线视频| 奇米色一区二区三区四区| 亚洲国产精品t66y|