Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize the small function of simple Calculator in C #

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how C#realizes the simple calculator small function, the article introduces very detailed, has certain reference value, interested small partners must read!

specific contents are as follows

Simple login interface.

Has a slide show effect. (Picturebox time control)

Calculator supports multidigit, decimal, parenthesis operations.

Music is a small control for practice (Listbox), you can select the specified song to play, directly ignore it.

Create winform form

The numbers and operators are button, and the input and output are textbox.

basic code

Click events in all button controls are added with the corresponding text.

For example, the button corresponding to the number 1 is

textBox1.Text += '1';

operator analogy

textBox1.Text +='*'; Core Code

The core code is all in the event of click of '='

Stack vs = new Stack();//Operator Stack Stack vvs = new Stack();//Operator Stack string a = textBox1.Text + '='; string b = ""; vvs.Push('='); for (int i = 0; i

< a.Length; i++) { if (a[i] >

= '0' && a[i]

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report