C#基本编程 [英] C# Basic programming

查看:49
本文介绍了C#基本编程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚接触编程可以任何人帮助我学习新技能。

我需要解决方案并解释以下问题。使用TextBox的C#.NET



1.写一个函数,显示一条消息,指示它被调用的次数:对于

instance该函数已被调用三次。编写一个程序,从main()调用此函数

10次。您将需要使用全局变量来存储计数。在main()函数之外声明了一个全局的

变量。以下问题..........



2.超级计算机的计算器应使用C语言设计。当工程师在项目上工作时,他们发现计算器没有给出非常好的b
大计算的正确答案。例如,如果要将150000000乘以10;计算器出错了

结果。检测到该错误是有限的整数范围。使用类型转换来设计一个

计算器,该计算器执行大输入的算术运算。 (例如; 150000000 * 10)以整数数据类型从用户输入





<来自评论>



让我提交我尝试的其他类型的问题。

编写一个程序,它取两个数字作为用户的输入并确定哪个更大<这两个数字是
。该程序还应该告诉我输入的数字是偶数还是奇数。请修改我的这个问题的版本,如果可能的话尝试纠正它。我有错误。





Hi Iam new to programming Can Any one help me to learn new skills .
I need solution and explanation for following problem . C#.NET using TextBox

1.Write a function that displays a message indicating the number of times it gets called: For
instance "The function has been called three times". Write a program that calls this function
10 times from main(). You will need to use a global variable to store the count. A global
variable is declared outside the main() function. for following problems ..........

2 .A calculator for a supercomputer is to be designed using C language. While the engineers were
working on the project they found that the calculator was not giving correct answers for very
large calculations. For example, if 150000000 is to be multiplied by 10; the calculator gave faulty
result. The bug was detected to be the limited range of integers. Use type casting to design a
calculator that performs arithmetic operations of large inputs. (e.g; 150000000 *10) Take input
from the user in integer data type.

<From Comment>

Let me submit another type of Question which I have tried .
Write a program which takes two numbers as input from user and determines which is the larger
of the two numbers. The Program should also tell which of the entered numbers is even or odd.Please reviwe my version of this question , if possible try to correct it . I am having error .


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Default3 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
    }
    protected void Unnamed1_Click(object sender, EventArgs e)
    {
        if (Convert.ToInt16(TextBox1.Text) > Convert.ToInt16(TextBox2.Text))
            if (Convert.ToInt16(TextBox2.Text) > Convert.ToInt16(TextBox3.Text))
                if (Convert.ToInt16(TextBox1.Text) > Convert.ToInt16(TextBox3.Text))
                {
                    Label2.Text = "Number  1 is greatest  amoung  3  + Number 2 is the  AVERAGE  + Number  3 is the  smallest ";
                }
                else  if (Convert.ToInt16(TextBox1.Text) < Convert.ToInt16(TextBox2.Text))
                    if (Convert.ToInt16(TextBox2.Text) < Convert.ToInt16(TextBox3.Text))
                        if (Convert.ToInt16(TextBox1.Text) < Convert.ToInt16(TextBox3.Text))
                        {
                            Label3.Text = "Number  3 is greatest  amoung  3  + Number 2 is the  AVERAGE  + Number  1 is the  smallest ";                           
                        }
                     }
}





感谢您的关注。如果你帮助我完成这个学习过程,真的很棒。



Thanks for your Interest. It will be really greatful if you help me with this learning process.

推荐答案

你正在使用什么书,现在就停止使用它。

作者对语言一无所知,只是略微(并且严重地)为特定语言添加了一个通用文本。



编写一个函数,显示一条消息,指示它被调用的次数:对于

实例该函数已被调用三次。编写一个调用此函数的程序

来自main()的10倍。你需要使用一个全局变量来存储计数。一个全局的

变量在main()函数之外声明。用于以下问题..... .....




C#不知道全局变量,语言中没有这样的东西。



如果他的意思是包含main方法的类中的类级变量,那么这是一个非常不同的确实是t对象,不应该以任何方式与全局变量混淆 - 因为它不是,甚至不是轻微的。
What ever book you are using, stop using it now.
The author has little clear idea of the language, and has just produced a general-purpose text slightly (and badly) addapted to the specific langauge.

"Write a function that displays a message indicating the number of times it gets called: For
instance "The function has been called three times". Write a program that calls this function
10 times from main(). You will need to use a global variable to store the count. A global
variable is declared outside the main() function. for following problems .........."


C# has no idea of "global variables", there are no such thing in the language.

If he means a class level variable within the class containing the "main" method, then that is a very different object indeed, and should not in any way be confused with a global variable - because it isn't, not even slightly.


检查这个... c#教程适合初学者。



Anto
Check this one... c# Tutorial for beginners.

Anto


这篇关于C#基本编程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆