The teacher asked the students while judging

Source: Internet
Author: User

The teacher asked the students, will you do the problem? If the student answers "Yes", you can go to school. If the student does not do (n), then the teacher tells again and asks the student if he will do it.
(1) Until the students ' union, they can only school.
(2) until the student council or the teacher told him 10 times not, all have to school (code 7)

Console.WriteLine ("Will it be?");            String a = Console.ReadLine ();            if (a = = "Y") {                Console.WriteLine ("School");            }            for (int i = 0; i < i++) {                                  Console.WriteLine ("Will It Be");                    A = Console.ReadLine ();                    if (a = = "Y") {                        goto FX;                    }                            }          FX:            Console.WriteLine ("Press Any to build school");            Console.readkey ();

  

Use the While statement to determine

Console.WriteLine ("Will do It"); String a = Console.ReadLine (); if (a = = "Y") { Console.WriteLine ("School"); } int i=0; while (a!= "y" && i<10) { Console.WriteLine ("Will do It"); String B = Console.ReadLine (); if (b = = "Y") { Console.WriteLine ("After School"); break; } i++; } Console.readkey ();

  

The teacher asked the students while judging

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.