当前位置:网站首页>c语言hello world代码(代码编程入门)
c语言hello world代码(代码编程入门)
2022-07-31 14:25:00 【全栈程序员站长】
大家好,又见面了,我是你们的朋友全栈君。
using System;
using System.Collections.Generic;
public class MyClass
{
struct Name{
public string FirstName;
public string LastName;
public string GetName(){
return FirstName + "·" + LastName;
}
}
struct Vector3{
public float x;
public float y;
public float z;
public double Distance(){
return Math.Sqrt(x*x+ y*y+ z*z);
}
}
public static void RunSnippet()
{
Name myName;
myName.FirstName = "Alexander";
myName.LastName = "Azhar";
System.Console.WriteLine("My name is " + myName.GetName());
Vector3 point;
System.Console.WriteLine("Please enter three points' position to calculate its distance: ");
point.x = Convert.ToInt32(System.Console.ReadLine());
point.y = Convert.ToInt32(System.Console.ReadLine());
point.z = Convert.ToInt32(System.Console.ReadLine());
System.Console.WriteLine("The Sqrt distance of the three points is "+point.Distance()+" .");
}
#region Helper methods
public static void Main()
{
try
{
RunSnippet();
}
catch (Exception e)
{
string error = string.Format("---\nThe following error occurred while executing the snippet:\n{0}\n---", e.ToString());
Console.WriteLine(error);
}
finally
{
Console.Write("Press any key to continue...");
Console.ReadKey();
}
}
private static void WL(object text, params object[] args)
{
Console.WriteLine(text.ToString(), args);
}
private static void RL()
{
Console.ReadLine();
}
private static void Break()
{
System.Diagnostics.Debugger.Break();
}
#endregion
}
上面代码的结构一定要记住,因为结构比较好,所以和大家分享。
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/128463.html原文链接:https://javaforall.cn
边栏推荐
- Resnet&API
- 2021 OWASP TOP 10 漏洞指南
- Redis 】 【 publish and subscribe message
- 自制的数据库安全攻防题,相关靶机自己制作
- Introduction to BigDecimal, common methods
- The Selenium IDE of the Selenium test automation
- The 232-layer 3D flash memory chip is here: the single-chip capacity is 2TB, and the transmission speed is increased by 50%
- UnityShader入门学习(一)——GPU与Shader
- 消息队列消息数据存储MySQL表设计
- ADS communicate with c #
猜你喜欢
How to grab configuration information for DELL SC compellent storage system
Recommendation System - Recall Phase - 2013: DSSM (Twin Towers Model) [Embedding (Semantic Vector) Recall] [Microsoft]
Combination series - there are combinations when there are arrangements
最近很火的国产接口神器Apipost体验
The recently popular domestic interface artifact Apipost experience
Resolved (pymysqL connect to the database error) pymysqL. Err. ProgrammingError: (1146, "Table" test. Students' doesn 't exist ")
Uniapp WeChat small application reference standard components
尚硅谷-JVM-内存和垃圾回收篇(P1~P203)
Spark学习(3)-Spark环境搭建-Standalone
MySQL 23道经典面试吊打面试官
随机推荐
Shell script classic case: backup of files
SetoolKit User Guide
Shell script classic case: detecting whether a batch of hosts is alive
jOOQ 3.14 released - SQL/XML and SQL/JSON support
ERROR: Failed building wheel for osgeo
龟速乘【模板】
Nuget打包并上传教程
C语言基础练(九九乘法表)与打印不同星号图案
技能大赛训练题: 子网掩码划分案例
Introduction to BigDecimal, common methods
小试牛刀:Go 反射帮我把 Excel 转成 Struct
Open Inventor 10.12 Major Improvements - Harmony Edition
MySQL has played to such a degree, no wonder the big manufacturers are rushing to ask for it!
高等数学——常用不定积分公式
el-tooltip的使用
/etc/profile、/etc/bashrc、~/.bash_profile、~/.bashrc 文件的作用
Resolved (pymysqL connect to the database error) pymysqL. Err. ProgrammingError: (1146, "Table" test. Students' doesn 't exist ")
对数字化时代的企业来说,数据治理难做,但应该去做
MySQL【聚合函数】
OAuth2:搭建授权服务器