控制台应用程序,web应用程序以及windows应用程序具体区别,请举例说明谢谢

控制台应用程序,web应用程序以及windows应用程序具体区别,请举例说明谢谢,第1张

简单的说一下吧……

控制台是以源程序代码来显示你 *** 作过程的一种方式,也就是一个命令窗口,通过一些简单的程序,将一些数组、字符串等打印在控制台。例如window里面的运行cmd控制;玩CS时按~键就会显示控制台,它会显示你玩游戏的过程是如何控制的。

web应用程序通俗的讲,就是我们的网页。WEB应用程序一般是B/S模式(B/S就是浏览器端/服务器端应用程序,这类应用程序一般借助IE等浏览器来运行)。常见的计数器、留言版、聊天室和论坛BBS等,都是Web应用程序,不过这些应用相对比较简单,而Web应用程序的真正核心主要是对数据库进行处理,管理信息系统(Management

Information

System,简称MIS)就是这种架构最典型的应用。

windows应用程序开发出来以后就是像你常用的那些软件一样,有窗口,有按钮,有菜单……功能一般都比较强大,但是编辑起来也是比较麻烦。一般用c#,c++等面对对象的可视化编辑。想我们平时用的word,powerpoint的就是window应用程序,呵呵……

using System;

namespace ConsoleApp3

{

class Program

{

static void Main(string[] args)

{

Student s1 = new Student(1, "张三", 67, 89, 90);

Student s2 = new Student(2, "李四", 68, 90, 91);

Student s3 = new Student(3, "王五", 69, 89, 92);

Student s4 = new Student(4, "赵六", 70, 92, 93);

ConsoleWriteLine("输出结果");

s1disp(); s2disp(); s3disp(); s4disp();

ConsoleWriteLine("语文平均分:{0}数学平均分:{1}英语平均分:{2}", Studentavg1(), Studentavg2(), Studentavg3());

ConsoleReadKey();

}

class Student

{

int no;

string name;

int deg1;

int deg2;

int deg3;

static int sum1 = 0;

static int sum2 = 0;

static int sum3 = 0;

static int sn = 0;

public Student(int n, string na, int d1, int d2, int d3)

{

no = n; name = na;

deg1 = d1; deg2 = d2; deg3 = d3;

sn++;

sum1 += d1;

sum2 += d2;

sum3 += d3;

}

public void disp()

{

ConsoleWriteLine("学号:{0},姓名:{1},语文:{2},数学:{3},英语:{4},平均分:{5:f}", no, name, deg1, deg2, deg3, (double)(deg1 + deg2 + deg3) / 3);

}

public static double avg1() { return (double)sum1 / sn; }

public static double avg2() { return (double)sum2 / sn; }

public static double avg3() { return (double)sum3 / sn; }

};

}

}

给你一个完整的实例

1)新建一个“控制台应用程序”项目,项目名称保持默认的ConsoleApplication1

2)在解决方案资源管理种,选中 解决方案"ConsoleApplicaiton1", 点鼠标右键,调出右键菜单:添加 --> 新建项目

3)在“添加新项目”对话框中选择“类库”,保持项目名称为默认的ClassLibrary1

4)打开项目ClassLibrary1中的Class1cs文件

输入以下代码

using System;

using SystemCollectionsGeneric;

using SystemLinq;

using SystemText;

using SystemThreadingTasks;

namespace ClassLibrary1

{

    public class Class1

    {

        private string message;

        public string Message

        {

            get

            { return message; }

            set

            {

                message = value;

            }

        }

        public void ShowMessage()

        {

            ConsoleWriteLine(message);

        }

    }

}

5)在项目ConsolApplication1中,选中“引用”,鼠标右键调出菜单,然后点“添加引用”

6)在“引用管理器”中

7)添加完后,项目ConsoleApplication的引用中会看到引入的类库

8)打开项目ConsoleApplication1中Programcs,输入以下代码

using System;

using SystemCollectionsGeneric;

using SystemLinq;

using SystemText;

using SystemThreadingTasks;

//ClassLibrary1的名称空间

using ClassLibrary1;   

namespace ConsoleApplication1

{

    class Program

    {

        static void Main(string[] args)

        {

            // 实例化ClassLibrary1中的Class1

            Class1 c1 = new Class1();

            c1Message = "测试";

            c1ShowMessage();

            // 按回车键退出

            ConsoleReadLine();

        }

    }

}

9)运行

以上就是关于控制台应用程序,web应用程序以及windows应用程序具体区别,请举例说明谢谢全部的内容,包括:控制台应用程序,web应用程序以及windows应用程序具体区别,请举例说明谢谢、设计一个控制台应用程序,定义若干个学生对象,每个学生对象包括学号、姓名、语文成绩、数学成绩和英语成、C#在控制台应用程序怎么调用自己写的类库等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zz/9266214.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-04-26
下一篇2023-04-26

发表评论

登录后才能评论

评论列表(0条)

    保存