If Zhuge Liang used C to write the teacher’s model

Time:2021-7-23

See an article of 18 years“C + + version of chushibiao“, the webmaster thought it was very interesting, so he used the C # console to realize it again. There was no difficulty in technology, but it took 1 or 2 hours to copy the code. It was just boring to write and play. The viewer didn’t care about enumerations, class names and variable naming in Chinese, just for entertainment.


Background of graduation

Today, let’s express our admiration and nostalgia for the prime minister in a unique way!

In 221, Liu Bei became emperor and Zhuge Liang was Prime Minister. In the first year of Jianxing (223), Liu Bei died and entrusted Liu Chan to Zhuge Liang. Zhuge Liang carried out a series of correct political and economic measures, which made Shuhan prosperous. In order to realize the national unification, Zhuge Liang decided to go north to attack Wei in 227 after quelling the rebellion in the south. He planned to capture Chang’an of Wei. Before he left, he wrote to the later master, that is, this “chushibiao”.

C # source code

Some classes and enumerations defined

Public enum is the king's way;

/// 
///Emperor, your majesty, Wenjing, huanling
/// 
Public class
{
  Public string name;
  Public bool in;
  Public is king;

  Public ()
  {
    In = true;
    To be king is to be king;
  }
  Public bool Entrepreneurship (double percentage)
  {
    if (percentage < 0.5)
    {
      At = false;
      Console. Writeline ($"{name} is in the middle of business!";
      return false;
    }
    else
    {
      Console. Writeline (@ "{name} Xing Fu Han Shi, also in the old capital!");
      return true;
    }
  }

  Public void opens Shengting ()
  {
    Console. Writeline ("open Shengting, guangxiandi Yide!");
  }

  Public void: the spirit of a man of lofty ideals

  Public void object self thinning () {}

  Public void is a misnomer ()
  {
    Console. Writeline;
  }

  Public void
  {
    To be king is to be king;
  }

  Public void
  {
    To be king is to be king;
  }

  Public void () {}

  Public void bias ()
  {
    Console. Writeline;
  }

  Public bool (string)
  {
    If (Wang Dao. Ming = = be king)
    {
      return true;
    }

    return false;
  }

  Public bool implementation (string)
  {
    return true;
  }

  Public void
  {
    Console. Writeline;
  }

  Public void discuss this matter with each minister ()
  {
    Console. Writeline ("sigh and hate huanling.");
  }

  ~Jun () {}
}


Public enum

Minister of public class bodyguard
{
  Private Jun Liu Bei = new Jun ();
  Private Jun Liu Chan = new Jun ();

  Public string name;
  Public officials are officials by virtue;

  Public void ()
  {
    Console.writeline ($"Minister of the bodyguard ({name}) is unremitting");
  }

  Public bool: the privilege of chasing the Emperor ()
  {
    If (Liu Bei. Wei Jun = = Wang Dao. Ming)
    {
      return true;
    }
    else
    {
      return false;
    }
  }

  Public bool to your majesty ()
  {
    If (Liu Chan. Wei Jun = = Wang Dao. Ming)
    {
      return true;
    }
    else
    {
      return false;
    }
  }

  Public bool (string)
  {
    If (Wei Chen = = Chen De, Xian)
    {
      return true;
    }

    return false;
  }
}

A loyal man
{
  Private Jun Liu Bei = new Jun ();
  Private Jun Liu Chan = new Jun ();

  Public string name;
  Public = new ();

  Public void
  {
    Console. Writeline ($"loyal people ({name}) forgot to be outside!");
  }

  Public bool: the privilege of chasing the Emperor ()
  {
    If (Liu Bei. Wei Jun = = Wang Dao. Ming)
    {
      return true;
    }
    else
    {
      return false;
    }
  }

  Public bool to your majesty ()
  {
    If (Liu Chan. Wei Jun = = Wang Dao. Ming)
    {
      return true;
    }
    else
    {
      return false;
    }
  }

  Public bool (string)
  {
    If (Wei Chen = = Chen De, Xian)
    {
      return true;
    }

    return false;
  }
}

Public enum climate {prosperity, weakness, prosperity and decline}

/// 
///Cao Wei, Dongwu, Yizhou, first Han, later Han
/// 
Public class
{
  Public climate national movement;

  Public country ()
  {
    National movement = climate. Prosperity;
  }

  Public void put it into Yousi to discuss its punishment and reward (Minister of Bodyguard)
  {
    If (Minister. For minister = = minister virtue. Virtuous)
    {
      Console. Writeline (!);
    }
    else
    {
      Console. Writeline;
    }
  }

  ~Country () {}
}

/// 
///Guo Youzhi, Fei Yi
/// 
Public class: Minister of bodyguard;

/// 
///Dong Yun
/// 
Minister of bodyguard

/// 
///Chen Zhen
/// 
Minister of bodyguard

/// 
///Zhang Yi
/// 
A long history of public class

/// 
///Jiang Wan
/// 
Minister of bodyguard

/// 
///Xiang Chong
/// 
Middle governor: a loyal person {}

/// 
///Zhuge Liang
/// 
Prime Minister: Minister of bodyguard
{
  Public void (looking back)
  {
    Console. The former Emperor did not use his ministers to be despicable, and he wronged himself. He looked at his ministers in the thatched cottage three times, and consulted them with the affairs of the world. He was so grateful that he allowed the former Emperor to drive them away. It's been a year since I was appointed to the top of the post and was ordered to be in danger when the army was defeated. ");
  }

  Public void table loyalty ()
  {
    Console. Writeline ("the emperor knew that his officials were cautious, so he sent his officials to do great things in the face of collapse. Since he was ordered, he has lamented day and night for fear that the entrustment will not work, so as to hurt the Ming of the former Emperor. Therefore, when you cross Lu in May, you can go deep into it;
  }

  Public void battle ()
  {
    Console. Writeline ("today, the South has been determined, the army has been sufficient, when the award rate of the three armies, the north of the Central Plains, the common exhausted and dull, to fight away the criminals, to revive the Han Dynasty, but also in the old capital");
  }
  Public void goodbye ()
  {
    Console. Writeline ("today, we should be far away from you, but we don't know what to say.");
  }
}

Main method

static void Main(string[] args)
{
  First emperor = new emperor ();
  The name of Xiandi is "Xiandi";
  Xiandi. Entrepreneurship (0.49);

  Guoyizhou = new country ();
  Yizhou. National movement = climate. Fatigue;

  Console. Writeline ("this is a critical autumn!");

  Shi Zhong Guo You Zhi = new Shi Zhong ();
  Guo Youzhi. Name = Guo Youzhi;
  If (Guo Youzhi's special experience in pursuing the former Emperor) & Guo Youzhi's report to his majesty)
  {
    Guo Youzhi. Unremitting in the interior ();
  }

  Shi Zhong Fei = new Shi Zhong ();
  Fei Yi. Name = Fei Yi;
  If (Fei Yi's special experience in pursuing the former Emperor) & Fei Yi's report to his majesty)
  {
    Fei Yi. Unremitting in the interior ();
  }

  Shi Lang Dong Yun = new Shi Lang ();
  Dong Yun. Name = "Dong Yun";
  If (Dong Yun's special experience in pursuing the former Emperor) & Dong Yun's report to his majesty)
  {
    Dong Yun. Unremitting efforts ();
  }

  Middle governor Xiang Chong = new middle governor ();
  Xiang Chong. Name = Xiang Chong;
  If (Xiang Chong's special encounter with the late emperor) & Xiang Chong's report to his majesty)
  {
    Xiang Chong. Forget the body outside ();
  }

  Your majesty = new;
  If (your majesty. For you = = Wang Dao. Ming)
  {
    Your majesty, open the holy hearing;
    Your majesty, the spirit of a man of lofty ideals ();
  }
  else
  {
    Your majesty, bin Zibo;
    Your majesty, it is a misnomer;
  }

  Your majesty, governing the country ();

  Bool = false;
  Bool = false;
  Bool = false;
  Bool penalty no = false;
  Debug. Assert (Gongzhong = = Fuchong);
  Debug. Assert (zhizang = = penalty no);

  Those who commit crimes by bodyguards = new bodyguards ();
  To be a minister is to be a minister of virtue;
  The Minister of bodyguard is loyal and good = new minister of bodyguard ();
  To be loyal and good. To be a minister = to be virtuous and virtuous;
  If (your majesty. For you = = Wang Dao. Ming)
  {
    Yizhou. Put it into Yousi to discuss its punishment and reward;
    Yizhou. Put Yousi on its punishment and reward (for those who are loyal and kind);
  }
  else
  {
    Your majesty. Partiality ();
  }

  If (Guo Youzhi. Weichen = = Chende. Xian
    &&Fei Yi. Being a minister = = being virtuous and virtuous
    &&Dong Yun. Wei Chen = = Chen de. Xian)
  {
    Console. Writeline ("this is all good and real, and the ambition is to be loyal and pure, which is to leave your majesty a legacy after the emperor's brief introduction.");
  }

  String in the palace = null;
  If (your majesty) consult (things in the palace)
    &&Guo Youzhi. Planning Affairs (affairs in the palace)
    &&Fei Yi. Planning Affairs (affairs in the palace)
    &&Dong Yun. Planning Affairs (affairs in the palace))
  {

    Your majesty, carry out (a matter in the palace);
    Console. Writeline ("it's helpful to cure the disease of deficiency, it's beneficial to many people");
  }

  If (Xiang Chong, Wei Chen = = Chen De, Xian)
  {
    Console. Writeline ("sex is good, military is good");
    Console. Write ("the name of the former Emperor is:);
    The former Emperor said, "Neng.";
    Console. Writeline ("it's based on public opinion.");
  }

  String = null;
  If (your majesty. Consult)
  {
    Your majesty, carry out (a matter in the palace);
    Console. Writeline ("the line is harmonious, the good and the bad are the best!");
  }

  Jun Wenjing = new Jun ();
  Jun Hengling = new Jun ();
  Guoxianhan = new country ();
  Later Han Dynasty = New Kingdom ();

  Wen Jing. Pro virtuous minister far villain ();
  First Han Dynasty. National movement = climate. Prosperity;
  Hengling. Pro villain, far wise minister ();
  Later Han Dynasty. National movement = climate. Decadence;

  do
  {
    The former Emperor discussed this matter with his ministers;
  }While (the former Emperor);

  If (Guo Youzhi. Weichen = = Chende. Xian
          &&Fei Yi. Being a minister = = being virtuous and virtuous
          &&Dong Yun. Wei Chen = = Chen de. Xian)
  {
    Console. Writeline ("I know that Zhenliang is a dead minister, and I hope your majesty will believe it, and the prosperity of the Han Dynasty can be seen in a short time.");
  }

  Prime Minister Zhuge Liang = new prime minister ();
  Looking back on the past ();
  Zhuge Liang. Show loyalty ();
  Zhuge Liang. Ask for war ()// Therefore, he was loyal to his majesty
  Zhuge Liang. Farewell ();

}

Code output “graduation form”

出师表部分输出

The first emperor's business is not half done, but the middle road is broken!
This is the autumn of crisis!
The Minister of bodyguard (Guo Youzhi) is unremitting
The Minister of bodyguard (Fei Yi) is unremitting
The Minister of bodyguard (Dong Yun) is unremitting
Loyal man (Xiang Chong) forgets himself!
Open Shengting, guangxiandi Yide!
Punishment!
Reward!
This is all good and real, and the ambition is to be loyal and pure. It is because of the simplicity of the former Emperor and the legacy of his majesty.
It is beneficial to the cure of the disease
They are good at sex, good at military affairs.
The former Emperor called it: Neng
It is based on public opinion.
The good and the bad are the best!
Sigh and hate huanling.
I hope your majesty will believe in it, and the prosperity of the Han Dynasty can be seen in a short time.
The minister is based on cloth clothes. He works hard in Nanyang, lives in troubled times, and doesn't ask for information to reach the princes. The former Emperor did not use his ministers to be despicable, and he wronged himself. He looked at his ministers in the thatched cottage three times, and consulted them with the affairs of the world. He was so grateful that he allowed the former Emperor to drive them away. Later, when he was on top of the army, he was appointed to defeat the army and was ordered to be in danger. It has been one year since he came here.
The former Emperor knew that his officials were cautious, so he sent them to do great things in the face of collapse. Since he was ordered, he has lamented day and night for fear that the entrustment will not work, so as to hurt the Ming of the former Emperor. Therefore, in May, when you cross Lu, you will not be able to go deep.
Today, the South has been determined, and the army has been sufficient. When the award leads the three armies, the North determines the Central Plains, and the common people are exhausted and dull. They fight away the evildoers and assailants, revive the Han Dynasty, and return to the old capital.
Today, we should stay away from it. We don't know what to say.

Time is like running water, which can only flow away but not back.

  • Official account: Dotnet9
  • No.1 main micro signal: dotnet9
  • The wolf at the end of the desert
  • First:https://dotnet9.com/17536.html
  • Date: March 13, 2021

微信公众号:Dotnet9