当前位置: 首页 > news >正文

企业形象网站用什么语言开发卢松松wordpress

企业形象网站用什么语言开发,卢松松wordpress,软件外包价格一般多少,老板让做公司网站设计目录 .NET实操#xff1a;创建项目执行 C#基础语法数据类型变量实操001_变量如何在一个解决方案 中创建另一个项目实操002结构实操003-if else实操004-多分支多行注释按钮实操#xff1a;循环 面向对象基础如何在同一个项目下创建新的.cs文件实操-类的定义与访问实操-练习实操… 目录 .NET实操创建项目执行 C#基础语法数据类型变量实操001_变量如何在一个解决方案 中创建另一个项目实操002结构实操003-if else实操004-多分支多行注释按钮实操循环 面向对象基础如何在同一个项目下创建新的.cs文件实操-类的定义与访问实操-练习实操-方法实操计算器 综合实例 .NET dotnet5.NET合并了.NET Framework、.NET Core(可以跨平台)实操创建项目 我用的Visual Studio2022 先创建新项目再点击下一步后说明了解即可在找到相应文件位置后点击 “生成” 下方会出现 成功 之后 Debug 下会生成很多文件其中 xxx.exe 是生成的可执行文件在.NET平台是一种通用文件执行 C#基础语法 数据类型 简单数据类型值类型引用类型值存储在堆里面地址存储在栈里面) 变量 实操001_变量 namespace Demo001_变量 {internal class Program{ /////是注释 解释说明的作用/// summary/// 主方法程序的入口/// /summary/// param nameargs/paramstatic void Main(string[] args){//声明变量存储数据string message;//给变量赋值message 欢迎来到C#的世界;//使用变量Console.WriteLine(message);//存储员工的信息工号姓名性别入职日期基本工资部门岗位string emplyeeNo, name;bool gender;DateTime jobInDateTime;double salary;string departmentName;string job;Console.Write(请输入工号);emplyeeNo Console.ReadLine();Console.Write(请输入姓名);name Console.ReadLine();Console.Write(请输入性别);gender Convert.ToBoolean(Console.ReadLine());Console.Write(请输入入职日期yyyy-mm-dd:);jobInDateTime Convert.ToDateTime(Console.ReadLine());Console.Write(请输入基本工资);salary Convert.ToDouble(Console.ReadLine());Console.Write(请输入部门);departmentName Console.ReadLine();Console.Write(请输入岗位);job Console.ReadLine();//输出个人信息Console.WriteLine($工号{emplyeeNo}\n $姓名{name}\n $性别{gender}\n $入职日期{jobInDateTime}\n $基本工资{salary}\n $部门{departmentName}\n $岗位{job});}} }如何在一个解决方案 中创建另一个项目 后面的步骤前面有讲过。 注意点击 配置启动项 勾选 当前项目![启动项设置]](https://img-blog.csdnimg.cn/fd028c9cac10418a891dfc2ab073013b.png) 实操002 namespace Demo002_算术运算符 {internal class Program{static void Main(string[] args){DateTime dateOfBirth Convert.ToDateTime(1995-10-2);int age DateTime.Now.Year - dateOfBirth.Year;Console.WriteLine(年龄age);//age 和 age 区别//先用再加 先加再用bool gender true;gender false;//string sex gender true ? 男 : 女;string sex !gender ? 男 : 女;Console.WriteLine($性别{sex});Console.WriteLine();Console.Write(请输入账号);string loginId Console.ReadLine();Console.Write(请输入密码);string loginPassword Console.ReadLine();string loginMsg loginId admin loginPassword 123456 ? 登录成功 : 用户名或密码错误登录失败;Console.WriteLine(loginMsg);}} }结构 实操003-if else namespace Demo003_选择结构 {internal class Program{static void Main(string[] args){Console.WriteLine(请问是否进行C#学习y/n:);string input Console.ReadLine().ToLower();//输入转换为小写 .ToUpper()转化为大写if (input ! y input ! n) {Console.WriteLine(输入有误);}else{if (input y){Console.WriteLine(继续阅读);}else{Console.WriteLine(停止阅读);}}}} }实操004-多分支 namespace Demo004_多分支 {internal class Program{static void Main(string[] args){Console.WriteLine(*******年终奖判定程序**********);Console.WriteLine(请输入基本工资);double salary Convert.ToDouble(Console.ReadLine());Console.WriteLine(请输入考核等级ABCD);char level Convert.ToChar(Console.ReadLine().ToUpper());double reward;//奖金if (level A || level D)Console.WriteLine(等级输入有误);//多分支else{//if (level A)//reward salary * 6;//else if (level B)//reward salary * 3;//else if (level C)//reward salary * 2;//else//reward salary;//只能写等值判断switch (level){case A:reward salary * 6;break;case B:reward salary * 3;break;case C:reward salary * 2;break;default:reward salary;break;}Console.WriteLine($年终奖是{reward});}}} }多行注释按钮 实操循环 namespace Demo005_循环结构 {internal class Program{static void Main(string[] args){//forint i;//定义在外面比较好for(i 0; i 3; i) {Console.WriteLine(重要的事情说三遍);}//登录系统输入用户名和密码三次有效string userName, password;for(i 0;i 3; i){Console.WriteLine($第{i 1}次登录开始......);Console.Write(请输入用户名);userName Console.ReadLine();Console.Write(请输入密码);password Console.ReadLine();if(userName admin password admin) {Console.WriteLine(登录成功);break;//强制退出循环}else if (i 2) {Console.WriteLine(用户名或密码错误登录失败);}else{Console.WriteLine(三次机会已用完账号已锁定);}}}} }面向对象基础 如何在同一个项目下创建新的.cs文件 实操-类的定义与访问 Employee.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;namespace Demo006_类的定义和访问 {/*** 类名Employee* 功能模拟所有的职员对象* */public class Employee{//internal 去掉也不会报错 internal只能在这里访问到 public是都可以访问到//成员变量字段特征//string employeeNo;//这是私有的privatepublic string employeeNo;public string name;public bool gender;public double salary;//构造方法在实例化对象时调用//构造方法名称必须与类名一致public Employee(){//默认存在但是调用了带参构造在没有定义无参构造的时候调用无参会报错建议带上无参构造//Console.WriteLine(正在实例化员工对象...);}/// summary/// 带参数构造方法/// /summary/// param nameemployeeNo员工号/param/// param namename姓名/param/// param namegender性别/param/// param namesalary工资/parampublic Employee(string employeeNo, string name, bool gender, double salary){//this关键字正在实例化的对象this.employeeNo employeeNo;this.name name;this.gender gender;this.salary salary;}//方法对象的行为能力public void ShowEmployeeMsg(){Console.WriteLine(${this.employeeNo}\t{this.name}\t{(this.gender true ? 男 : 女)}\t{this.salary});}} } Program.cs namespace Demo006_类的定义和访问 {internal class Program{static void Main(string[] args){//实例化对象Employee emp01 new Employee();//访问变量对象名.变量名emp01.employeeNo 1234;emp01.name 张三;emp01.gender true;emp01.salary 6589;Employee emp02 new Employee();emp01.employeeNo 1235;emp01.name 王小二;emp01.gender false;emp01.salary 7800;Employee emp03 new Employee(1236, rose, false, 6500);//Console.WriteLine(${emp01.employeeNo}\t{emp01.name}\t{(emp01.gender true? 男:女)}\t{emp01.salary});//Console.WriteLine(${emp02.employeeNo}\t{emp02.name}\t{(emp02.gender true ? 男 : 女)}\t{emp02.salary});//Console.WriteLine(${emp03.employeeNo}\t{emp03.name}\t{(emp03.gender true ? 男 : 女)}\t{emp03.salary});//调用方法对象名.方法名emp01.ShowEmployeeMsg();emp02.ShowEmployeeMsg();emp03.ShowEmployeeMsg();}} }实操-练习 使用OOP的思想模拟个人手机的信息包含手机品牌型号价格和颜色 开机和关机的功能Phone.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;namespace Demo007_练习 {/*** 类名Phone* 功能模拟手机对象* */public class Phone{public string brand;//品牌public string type;//型号public double price;//价格public string color;//颜色public Phone(){Console.WriteLine(正在实例化手机对象...);}public Phone(string brand, string type, double price, string color){this.brand brand;this.type type;this.price price;this.color color;}public void OpenPhone(){Console.WriteLine(${this.brand}品牌{this.type}型号{this.price}元{this.color}的手机正在开机......);}public void ClosePhone(){Console.WriteLine(${this.brand},{this.type},{this.price},{this.color} 关机了);}}} 实操-方法 Employee.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Xml.Serialization;namespace Demo006_类的定义和访问 {/*** 类名Employee* 功能模拟所有的职员对象* */public class Employee //internal 去掉也不会报错 internal只能在这里访问到 public是都可以访问到{//成员变量字段特征//string employeeNo;//这是私有的privatepublic string employeeNo;public string name;public bool gender;public double salary;//构造方法在实例化对象时调用//构造方法名称必须与类名一致public Employee() {//默认存在但是调用了带参构造在没有定义无参构造的时候调用无参会报错建议带上无参构造Console.WriteLine(正在实例化员工对象...);}public Employee(string employeeNo, string name, bool gender, double salary){//this关键字正在实例化的对象this.employeeNo employeeNo;this.name name;this.gender gender;this.salary salary;}//方法对象的行为能力public void ShowEmployeeMsg(){Console.WriteLine(${this.employeeNo}\t{this.name}\t{(this.gender true ? 男 : 女)}\t{this.salary});}//请假public void SendMsg(string type,DateTime beginDate,int days,string reason){Console.WriteLine(${this.employeeNo}的员工申请{type});Console.WriteLine($开始日期{beginDate}\n $请假天数{days}\n $结束日期{beginDate.AddDays(days)}\n $请假事由{reason}\n);}//年终奖public double GetReward(string level){double reward;switch (level){case A:reward this.salary * 6;break;case B:reward this.salary * 3;break;case C:reward this.salary * 2;break;default:reward this.salary;break;}return reward;//返回语句}} } Program.cs using Demo006_类的定义和访问;namespace Demo008_方法 {internal class Program{static void Main(string[] args){Employee employee1 new Employee(1234,张三,true,5000);employee1.SendMsg(事假, Convert.ToDateTime(2023-11-10 09:00:00), 2, 家里有事);Employee employee2 new Employee(1235, 李四, true, 6000);employee2.SendMsg(婚假, DateTime.Now, 10, 回家结婚);Console.Write(请输入考核等级);string inputLevel Console.ReadLine();double money employee1.GetReward(inputLevel);Console.WriteLine($年终奖金是{money});}} }实操计算器 Calculator.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;namespace Demo009_Calculator {public class Calculator{public int GetResult(int a, int b, string type){int c 0;if (type ){c a b;}else if (type -){c a - b;}else if (type *){c a * b;}else if (type /){if (b 0){Console.WriteLine(除数为0无法计算);}else{c a / b;}}return c;}}} Program.cs namespace Demo009_Calculator {internal class Program{static void Main(string[] args){//使用OOP思想实现两个数的加减乘除运算。Calculator calculator new Calculator();Console.Write(请输入第一个数);int a Convert.ToInt32(Console.ReadLine());Console.Write(请输入第二个数);int b Convert.ToInt32(Console.ReadLine());Console.Write(请输入运算符/ - / * / /);string type Console.ReadLine();//计算int c calculator.GetResult(a, b, type);Console.WriteLine(${a}{type}{b}{c});}} }综合实例 *以OOP的思想实现猜拳游戏 *计算机和用户实现猜拳可以出剪刀、石头和布。 *剪刀用0表示石头用1表示布用2表示。 *程序启动系统默认可以玩10局用户玩完一局之后可以按任意键继续按q退出退出后需显示实际玩了几局用户赢了几局电脑赢了几局平了几局如果用户赢的局数大于电脑赢的局数显示用户大获全胜如果电脑赢的局数大于用户赢的局数显示用户败给了电脑如果赢的局数相同显示打成了平手。*每一局游戏的游戏规则 *先用户出拳输入0 - 2为后显示用户出的拳是什么如果用户出的不是0 - 2提示用户输入错误重新输入直到用户输入正确为止 *再由电脑随机出拳电脑产生0 - 2之间的随机数也要显示电脑出的拳是什么然后判断电脑和用户的输赢关系并给出适当的提示比如本局是用户赢了还是电脑赢了还是平局Player.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Channels; using System.Threading.Tasks;namespace Demo010_综合案例 { /// summary/// 玩家类/// /summarypublic class Player{public string name;//玩家的昵称/// summary/// 玩家出拳/// /summary/// returns/returnspublic int Throw(){while (true){try{Console.WriteLine($请{this.name}出拳);int point Convert.ToInt32(Console.ReadLine());if (point 0 point 3){return point;}elseConsole.WriteLine(输入有误请输入0-2);}catch (Exception ex){Console.WriteLine (输入有误请输入数字);}}}} } Computer.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;namespace Demo010_综合案例 {public class Computer{public int CreateRandomNum(){Random r new Random();return r.Next(3);}} } GuessGame.cs using System; using System.Collections.Generic; using System.Linq; using System.Security.Cryptography; using System.Text; using System.Threading.Tasks;namespace Demo010_综合案例 {/// summary/// 猜拳游戏类/// /summarypublic class GuessGame{Player player new Player();Computer computer new Computer();/// summary/// 输入玩家的昵称/// /summarypublic void InputePlayName(){Console.Write(请输入昵称);player.name Console.ReadLine();}/// summary/// 欢迎界面/打印界面/// /summarypublic void ShowMsg() {Console.WriteLine(*****************************);Console.WriteLine(******欢迎来到猜拳游戏*******);Console.WriteLine(*****************************);}/// summary/// 程序启动/// /summarypublic void Start(){this.ShowMsg();InputePlayName();int p1 player.Throw();int p2 computer.CreateRandomNum();string quan1 ConvertInToString(p1);string quan2 ConvertInToString(p2);Console.WriteLine(${player.name}出的拳是{quan1});Console.WriteLine($电脑出的拳是{quan2});Judge(p1, p2);Console.WriteLine(是否继续下一局按任意键继续按q退出);string input Console.ReadLine().ToLower();if(input q){Console.WriteLine(游戏正在退出...);Console.ReadKey();//需要按一个键}Console.ReadKey();Console.Clear();}/// summary/// 数字的点数转换为字符串的拳/// /summary/// param namepoint点数/param/// returns拳/returnspublic string ConvertInToString(int point){if(point 0) {return 剪刀;}if (point 1){return 石头;}return 布;}/// summary/// 判断输赢/// /summary/// param nameplayerPoint玩家的点数/param/// param namecomputerPoint电脑的点数/parampublic void Judge(int playerPoint, int computerPoint){//0剪刀 1石头 2布//用户赢0(2)-2,1(0)1,2(1)1int diff playerPoint - computerPoint;if (diff 0) {Console.WriteLine(平局);}else if (diff -2 || diff 1) {Console.WriteLine($用户{player.name}赢了一局);}else{Console.WriteLine(电脑赢了一局);}}} } Program.cs namespace Demo010_综合案例 {internal class Program{static void Main(string[] args){//以OOP的思想实现猜拳游戏//计算机和用户实现猜拳可以出剪刀、石头和布。//剪刀用0表示石头用1表示布用2表示。//程序启动系统默认可以玩10局用户玩完一局之后可以按任意键继续按q退出退出后需显示实际玩了几局用户赢了几局电脑赢了几局平了几局如果用户赢的局数大于电脑赢的局数显示用户大获全胜如果电脑赢的局数大于用户赢的局数显示用户败给了电脑如果赢的局数相同显示打成了平手。//每一局游戏的游戏规则//先用户出拳输入0 - 2为后显示用户出的拳是什么如果用户出的不是0 - 2提示用户输入错误重新输入直到用户输入正确为止//再由电脑随机出拳电脑产生0 - 2之间的随机数也要显示电脑出的拳是什么然后判断电脑和用户的输赢关系并给出适当的提示比如本局是用户赢了还是电脑赢了还是平局GuessGame guessGame new GuessGame();guessGame.Start();Player p new Player(); p.name 张三;}} }
http://www.yingshimen.cn/news/125471/

相关文章:

  • 电商网站建设需求分析 实例题怎么自己做游戏软件
  • 电子商城网站开发需求分析模板菏泽定制网站建设推广
  • 手机软件开发用什么语言seo搜索排名优化方法
  • 哈尔滨网站推广公司办公室设计平面图
  • 网站建设试手需要买服务器吗网站虚拟主持人制作
  • 福鼎市城市建设监察大队网站外贸电商做俄罗斯市场网站
  • 搜索网站开发背景兰州网站建设实验总结
  • asp资源下载网站公司网站模板侵权案例
  • 中国制造网注册网站免费注册可以做四级听力的网站
  • 企业网站的标题关键词合肥餐饮网站建设
  • 网站主关键词如何优化深圳seo外包公司
  • ajax瀑布流网站模板个人注册公司的详细步骤
  • 怎么建设网站视频教程wordpress文章只允许投稿者浏览
  • 孝感做网站的公司内蒙古建筑培训网
  • 宁波网站建设公司在哪里网站外链怎么做
  • 注册国外网站用什么邮箱娱乐网站建设ppt
  • 站长工具seo综合查询张家界新娘中国建设银行网站北京网点
  • 怎么把地图放到网站上wordpress怎样删除主题
  • 怎么做网站小编网站一般需要怎么推广
  • 做详情页的网站德阳北京网站建设
  • 网站制作需要哪些软件搭建论坛网站多长时间
  • 百度地图手机网站代码缅甸新闻最新消息
  • 网站建设费 科研 设备费推广方案怎么做
  • 网站其它方面seo情况wordpress制作xml
  • 门户网站建设好处中信建设有限责任公司陶扬
  • wordpress滑动登录seo网站描述之间用什么标点符号
  • 标题优化怎样选关键词东莞企业网站优化
  • 网站怎么做seo_怎么更改网站
  • 响应式的网站做优化好吗电子商城网站开发支持手机端
  • 创意个人网站设计湖南网站建设seo优化