我们这边使用Visual Studio 2017来做为程序的编译工具,
其他版本来做练习也是没有问题的。
记得帮专案命名,选择路径,命名方案,一个方案下可以包含多个专案
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CsharpDemo
{
class Program
{
static void Main(string[] args)
{
}
}
}
在说明完结构後想必各位也手痒痒想来写写看了
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CsharpDemo
{
class Program
{
static void Main(string[] args)
{
//印出文字
Console.WriteLine("Hello world");
Console.ReadKey();
}
}
}
Hello world
恭喜你!你的程序诞生了!
但刚刚究竟发生什麽事情呢?让我们继续看下去!
原来它的结构是这样啊!?
在未来我们会更详细的说明他们其中的含意,我们今天先来教大家之後常常会看到的函式
函式 | 用途 |
---|---|
Console.WriteLine() | 输出(会换行) |
Console.Write() | 输出(不换行) |
Console.ReadLine() | 读取输入的资料 |
Console.ReadKey() | 取得使用者按下的下一个字元或功能键 |
我们这边的Console.ReadKey() 主要用途只是要让主控台不会跑完程序就关闭
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CsharpDemo
{
class Program
{
static void Main(string[] args)
{
//印出文字
Console.WriteLine("姓名 : 孤独一只鸡");
Console.WriteLine("年龄 : 48岁");
Console.WriteLine("血型 : O型");
Console.WriteLine("星座 : 金牛座");
Console.WriteLine("自我介绍 : 我像是一只你可有可无的小鸡");
Console.ReadKey();
}
}
}
结果:
姓名 : 孤独一只鸡
年龄 : 48岁
血型 : O型
星座 : 金牛座
自我介绍 : 我像是一只你可有可无的小鸡
前言 今天来聊一个看起来不浪费的浪费。 多工会怎样 在我们的成长过程中,应该不只一次会听到前辈们的告...
开始之前,我相信你已经有碰过flask的经验,或是至少知道藉由 pip install Flask ...
前言 程序写了一阵子之後,工程师就会发展出自己习惯的模式,小到命名方式,大到系统架构,而在我们团队中...
在上一篇我们认识了一些Selector,包括所有元素选择器、指定元素选择器、ID选择器和Class选...