See a 18 years of the article “C++ version of the teacher “, webmaster feel very interesting, using C# console also achieved a time, no technical difficulty, but the replication of the code cost 1, 2 hours, pure boring writing to play, see people don’t care about enumeration, class name, variable Chinese name, pure for entertainment.

Background (Copy the original text)

Today, let us code farmers in a unique way, to express our admiration and memory of prime minister!

In 221, Liu Bei proclaimed himself emperor with Zhuge Liang as prime minister. In 223, The first year of Jianxing of Shu Han, Liu Bei died of illness and entrusted Liu Chan to Zhuge Liang. Zhuge Liang implemented a series of relatively correct political and economic measures, which made The territory of Shu Han prosperous. In order to unify the whole country, After quelling the rebellion in the south, Zhuge Liang decided in 227 years (the fifth year of Jianxing) to attack wei in the north, intending to capture Chang ‘an of Wei. Before he left, he sent a letter to his later master, namely, “The Journey of Teachers”.

C # source code

Define some classes, enumerations

Public enum Wang Dao {Ming, Ming}; // </summary> public class {public string name; Public bool in; Public way is king; Public jun () {in = true; To be king = to be king. Ming; } public bool percentage (double percentage) {if (percentage < 0.5) {if = false; Console.WriteLine($"{name} WriteLine) ); return false; } else {Console.WriteLine(@"{name}) {Console.WriteLine(@"{name}); ); return true; }} public void WriteLine() {Console.WriteLine() {Console.WriteLine(); ); } public void void () {} public void void () {} public void void () {} public void void () {} ); } public void () {public void () { Ming; } public void * * * * * * * * * * * * * * * Faint; } public void void () {} public void void () {Console. ); } public bool (string) {if (string). {return true; } return false; } public bool implement (string things) {return true; } public void say (string say) {Console.WriteLine(say); } public void () {Console.WriteLine(" Sigh hate huan Ling." ); } ~ ~ ~ () {}} public enum public class {private private = new private (); Private = new (); Public string Name; Public minister de for minister; Public void WriteLine() {Console.WriteLine($" WriteLine "); } public bool () {if (liu Bei) {if (liu Bei) For you == king's way. {return true; } else { return false; }} public bool to your Grace () {if (liu Chan) For you == king's way. {return true; } else { return false; }} public bool (string) {if (string == string) {if (string == string) Y) {return true; } return false; }} private = new (); Private = new (); Public string Name; Public = new(); Public void WriteLine() {Console.WriteLine($" WriteLine ") {Console.WriteLine($" WriteLine "); ); } public bool () {if (liu Bei) {if (liu Bei) For you == king's way. {return true; } else { return false; }} public bool to your Grace () {if (liu Chan) For you == king's way. {return true; } else { return false; }} public bool (string) {if (string == string) {if (string == string) Y) {return true; } return false; }} public enum {/// </summary> public class {// </summary> public class {public climate; Public () {country = climate. Prosperity; } public void put into its punishment reward (guards of the minister) {if (minister). I == I Germany. {Console.WriteLine(" Reward!" ); } else {console. WriteLine(" sentence! ); () {}}}} - countries / / / < summary > / / / guo togeher, fei yi / / / < summary > public class shi: bodyguard minister {}; /// </summary> public class {} // </summary> public class {} // </summary> {} /// </summary> /// </summary> public class Wan Wan // wan Wan // wan Wan // wan Wan // Wan Wan // Wan Wan // Wan Wan // wan Wan // wan Wan // // </summary> </ prime minister: {public void look back on the past () {Console. The first emperor not to minister mean, wei since qu, three ministers in grass lu, advisors to the world of things, by gratitude, then xu emperor to drive chi. Twenty years have passed since I was appointed in defeat and in danger." ); } public void 表 示 fidelity () {Console.WriteLine(" The first emperor knew the minister was cautious, so he sent the minister with great events. Since receiving the order, long night worry sigh, fear entrust not effect, in order to hurt the Ming emperor. So may crossing lu, deep barren. ); }} now the south has decided, the troops have enough, when the award rate of the three armies, the north of the Central Plains, exhausted and inferior, except the criminals, xing Fu Han room, also in the old capital. ); } public void leave () {Console.WriteLine(" now, I feel sad, I don't know what to say." ); }}Copy the code

The Main method

Static void Main(string[] args) {args = new args (); First emperor. Name = "first emperor "; Entrepreneurship (0.49); State = new state (); Yizhou. National transport = climate. Exhausted disadvantages; Console.WriteLine(" This is a critical autumn also!" ); Guo Yuzhi = new Shi Zhong (); Guo Youzhi. Name = "Guo Youzhi "; If (Guo Youzhi. Special Encounter in Pursuit of the former Emperor () && Guo Youzhi. Report to your Majesty () {Guo Youzhi. Unremitting in (); } Qiyi = new Qiyi (); Yi Yi. Name = "Yi Yi "; Yi yi. A Special Encounter in Chasing after the former emperor. Pay back to your Majesty. Unremitting in (); } = new (); Name = "dong yun "; If (Dong Yun. The Special Encounter of chasing after the former emperor () && Dong Yun. To your Majesty () {Dong Yun. Unremitting in (); } new (); Xiang chong. Name = "Xiang Chong "; Xiang Chong. The Special Encounter of chasing after the former emperor. Repay it to your Majesty. Forget oneself (); } your majesty = new Majesty (); Your Majesty == The way of the king. Ming) {Your Majesty. Open holy Hearing (); Majesty. The spirit of a noble man (); } else {your Majesty. Bin From thin (); Your Majesty. } Your Majesty. Bool gongzhong = false; Bool house = false; Bool cheok = false; Bool penalty no = false; Debug.assert (Palace == Palace); Debug.Assert(send message == no punishment); A traitor = a traitor of the bodyguard (); Wrongdoer. For minister = minister virtue. Rape; The servant of the bodyguard is a loyal and good man (); For the loyal and good. For the minister = minister virtue. Xian; Your Majesty == The way of the king. Ming) {Yizhou. On the punishment reward (wrongdoer); Yizhou. Put into a division on its punishment reward (loyal good); } else {your Majesty. Groups (); } If. I == I Germany. Xian && Fei Yi. I == I Germany. Xian && Dong Yun. I == I Germany. {console. WriteLine(" This is good and honest, thinking and faithful, is the first emperor to leave your Majesty." ); } string = null; If (your Majesty. Advisors (matters in the palace) && Guo Youzhi. Counsel (affairs of the palace) && Fei Yi. Counsel (palace affairs) && Dong Yun. Counsel (business at court) {your Grace. To perform (affairs of the palace); Console.WriteLine(" for advantage of deficiency "); } if (to pet. I == I Germany. {Console.WriteLine(" sex line shu jun, xiao Chang military." ); Console.Write(" The emperor said: "); The first Emperor said (" Neng "); Console.WriteLine(" Take public opinion to favor the supervisor." ); } string things in camp = null; If (your Majesty) {your Majesty. To perform (affairs of the palace); Console.WriteLine(" row array harmony, pros and cons get!" ); } new (); = new (); = new (); Guo Hou Han = new guo (); Wenjing. The kinsmen, sages, ministers and villains (); China = climate. Xinglong; Heng Ling. Kiss villain Yuan Xian Chen (); Later Han dynasty. National transport = climate. Crashing down. Do {predi. Every minister to discuss this matter (); } while (preempt. In); If (Guo Youzhi. I == I Germany. Xian && Fei Yi. I == I Germany. Xian && Dong Yun. I == I Germany. } {" I know that I am a good and faithful minister, and may your majesty write this letter to me, and I will wait for you as soon as possible." ); } Prime minister Zhuge Liang = new prime minister; Looking back on the past (); Show loyalty (); Zhuge Liang. // This minister therefore submitted to the former emperor and loyal to your Majesty's post also Zhuge Liang. Say goodbye (); }Copy the code

Code output “Teacher table”

Since the first emperor started a business, the middle way collapsed. This is the autumn of critical survival! The minister of the bodyguard (Guo Youzhi) unremittingly in the minister of the bodyguard (fei Yi) unremittingly in the minister of the bodyguard (Dong Yun) unremittingly in the person of the loyal ambition (to pet) forget oneself in the outside! Open holy listen, light first emperor heritage! Punishment! Enjoy! All of these are good and solid, and are faithful and pure. For advantage of deficiency disease, a wide beneficial sex shu are, xiaochang military. The first emperor said: can take the public opinion to favor for the governor. Line array harmony, the pros and cons of the place! Sigh hated Huan Ling. This knowledge of the virtuous good dead minister, may your Majesty's dear letter, then the long of the Han house, can be counted day and wait for also. This cloth cloth, gonggeng in Nanyang, gou life in the troubled times, not in the hou. The first emperor not to minister mean, wei since qu, three ministers in grass lu, advisors to the world of things, by gratitude, then xu emperor to drive chi. Twenty years have passed since I was appointed at the time of defeat and at the time of danger. The first emperor know minister cautious, so collapse send minister to the event also. Since receiving the order, long night worry sigh, fear entrust not effect, in order to hurt the Ming emperor. So may cross lugu, deep barren. Now the south has set, the armor has enough, when the award rate of the three armies, the north of the Central Plains, ordinary exhausted and inferior, bustling in addition to the villains, xing Fu Han room, also in the old capital. Now be far away, I feel sad, I don't know what to say.Copy the code