Exercise: diamond output on the console

Source: Internet
Author: User

This is the first exercise I did when I first got into my internship-output a diamond in the console.

After a few months of access to C #, it turned out to be the first time you touch the console ,--.

This is the prototype of the battle.

A lot of tricks,CodeAbstract.

 

 

I am still familiar with winform and plan to print diamond in winform.

I tried to call the console for output, but the effect was not good.

The key is that you can call the console in winform. The method is as follows:

[System. Security. suppressunmanagedcodesecurity] [dllimport ("Kernel32", charset = charset. Auto)] Static extern bool allocconsole (); // you can call allocconsole () again.

 

 

We also need to change the code to object-oriented. After studying what is Object-oriented for a long time, we found that for so long,

I think I know something about object-oriented. In the end, it is the opposite. I should be called process-oriented programming...

--| Or neither of them. If you are a programmer like me, there is no such thing as weird...

Or lay a good foundation for programming...

 

Source code download

 

<Console _ Drawing a diamond OOP> the modified version deletes unnecessary code and Implements similar methods,

Nothing changed. The output method is transplanted to the diamond class. It should be similar. XD

 

 

 

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.