_09_while Cycle __

Source: Internet
Author: User

classWhileapp {//This is a server model that supports single-user     Public Static voidMain () {//Welcome information for printing SoftwareConsole.WriteLine ("Welcome to use Whileapp V0.1"); //Print command input characterConsole.Write (">"); //command to store the user's commands        stringcommand; //commands to read into the user//command exits the program for exit         while(Command = Console.ReadLine ())! ="Exit")        {            Switch(command) {//handling the Get command                 Case "Get": Doget ();  Break; //working with put commands                 Case "put": DoPut ();  Break; //Handling Default Commands                default: Dodefault ();  Break; }            //Print command input characterConsole.Write (">"); }    }    //handling the Get command    Private Static intdoget () {//to add a real get processing actionConsole.WriteLine ("get file ... ok"); return 0; }    //working with put commands    Private Static intDoPut () {//to add a real put processing actionConsole.WriteLine ("transfer files ... ok"); return 0; }    //Handling Default Commands    Private Static intDodefault () {//Print error messageConsole.WriteLine ("Command Error"); //prompt for correct usageConsole.WriteLine ("the set of commands supported by Whileapp V0.1 are:"); Console.WriteLine ("\tget:\t getting files"); Console.WriteLine ("\tget:\t Transferring Files"); Console.WriteLine ("\texit:\t Exit Program"); return 0; }}

Run results

_09_while Cycle __

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.