当前位置:网站首页>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
边栏推荐
- /etc/profile、/etc/bashrc、~/.bash_profile、~/.bashrc 文件的作用
- 技能大赛训练题: 子网掩码划分案例
- For enterprises in the digital age, data governance is difficult, but it should be done
- Nuget打包并上传教程
- leetcode:2032. 至少在两个数组中出现的值
- ADS communicate with c #
- LeetCode·每日一题·1161.最大层内元素和·层次遍历
- AWS实现定时任务-Lambda+EventBridge
- 我把问烂了的MySQL面试题总结了一下
- Description of Hikvision camera streaming RTSP address rules
猜你喜欢
![Miller_Rabin Miller Rabin probability sieve [template]](/img/51/8dcc9f78478debf7d3dcfa6d1a23e3.png)
Miller_Rabin Miller Rabin probability sieve [template]

Motion capture system for end-positioning control of flexible manipulators

SetoolKit User Guide

【redis】发布和订阅消息

I summed up the bad MySQL interview questions

Redis与分布式:集群搭建

For enterprises in the digital age, data governance is difficult, but it should be done

Spark学习(3)-Spark环境搭建-Standalone

3.爬虫之Scrapy框架1安装与使用

1-hour live broadcast recruitment order: industry leaders share dry goods, and enterprise registration is open丨qubit · point of view
随机推荐
LeetCode只出现一次的数字
Open Inventor 10.12 重大改进--和谐版
常用工具命令速查表
C# Get network card information NetworkInterface IPInterfaceProperties
LeetCode·每日一题·1161.最大层内元素和·层次遍历
2021 OWASP TOP 10 漏洞指南
微服务架构选型
龟速乘【模板】
Redis 】 【 publish and subscribe message
I summed up the bad MySQL interview questions
Nuget打包并上传教程
Redis与分布式:哨兵模式
ML, DL, CV common problems sorting
MySQL【子查询】
Open Inventor 10.12 Major Improvements - Harmony Edition
一篇文章讲清楚!数据库和数据仓库到底有什么区别和联系?
Why do we need to sub-library and sub-table?
技能大赛训练题: 子网掩码划分案例
OpenShift 4 - 定制 RHACS 安全策略,阻断生产集群使用高风险 Registry
[QNX Hypervisor 2.2 User Manual]9.14 safety