OUT函数及其熟练使用,split的用法
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks; namespace OUT函数
{
class Program
{
//public void outzhi(double a, double b, double c, out double j1, out double j2)
public void outzhi(double a, double b, double c, out string j1, out string j2)
{
double de = b * b - * a * c;
if (de < )
{
Console.WriteLine("函数没有实根");
j1 = j2 = ""; }
else
{
double x1 = (-b + Math.Sqrt(de)) / ( * a);
double x2 = (-b - Math.Sqrt(de)) / ( * a);
if (de == )
{
Console.WriteLine("方程有两个相同的实根");
j1 = j2 = x1.ToString();
}
else
{
Console.WriteLine("方程有两个不同的实根");
//Console.Write("x1=" + x1); Console.Write(" x2=" + x2);
j1 = x1.ToString();
j2 = x2.ToString();
}
} } static void Main(string[] args)
{
Program hanshu = new Program();
Console.Write("请输入a=");
double a = double.Parse(Console.ReadLine());
Console.Write("请输入b=");
double b = double.Parse(Console.ReadLine());
Console.Write("请输入c=");
double c = double.Parse(Console.ReadLine());
//double j1 = 0;
//double j2 = 0;
string j1 = "";
string j2 = "";
hanshu.outzhi(a, b, c, out j1, out j2);
Console.WriteLine("第一个根x1=" + j1);
Console.Write("第二个根x2=" + j2);
Console.ReadLine(); }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks; namespace _0630下午
{
class Program
{
public void hou()
{
int sum = ;
for (int i = ; i > ; i--)
{
if (i == )
{
sum = ;
}
else
{
sum = (sum + ) * ;
}
}
Console.Write(sum);
} public int jiafen(int a)
{
a+= ;
return a;
} public void jiafen2(int[] a)
{
int l= a.Length;
for (int i = ; i < l; i++)
{
a[i] += ;
}
} public int [] jiafen4(int[] a)
{
int l = a.Length;
for (int i = ; i < l; i++)
{
a[i] += ;
}
return a;
} public void jiafen3(int[] a, out int[] b)
{
int l = a.Length;
for (int i = ; i < l; i++)
{
a [i] = a[i] + ;
}
b = a;
} static void Main(string[] args)
{
//out 传值 形式参数:只给值,不给变量名(传值) 实际参数:将变量名传给函数(传址)
//out是实参 Program hanshu=new Program();
//猴子
//hanshu.hou();
//Console.ReadLine(); //输入班级人数,根据人数输入每个人的成绩
//本班都是少数民族学生,每个人+10分
//写一个专门+10分的函数,参数是这个分数的数组
Console.WriteLine("请输入班级的人数");
int renshu = int.Parse(Console.ReadLine());
int[] fen = new int[renshu];
for (int i = ; i < renshu ;i++ )
{
Console.WriteLine("请输入第{0}名同学的成绩",(i+));
fen[i] = int.Parse(Console.ReadLine());
}
//for(int i=0;i <renshu ;i++)
//{
// fen[i ]= hanshu.jiafen(fen[i]);
//} //hanshu.jiafen2(fen );
//hanshu.jiafen3(fen,out chengji); int []chengji=new int [renshu ];
hanshu.jiafen3(fen,out chengji );
foreach(int aa in chengji )
{
Console.WriteLine(aa );
}
foreach (int aa in fen )
{
Console.WriteLine(aa);
}
Console.ReadLine(); }
}
}
split的使用

OUT函数及其熟练使用,split的用法的更多相关文章
- 表值函数与JS中split()的联系
在公司用云平台做开发就是麻烦 ,做了很多功能或者有些收获,都没办法写博客,结果回家了自己要把大脑里面记住的写出来. split()这个函数我们并不陌生,但是当前台有许多字段然后随意勾选后的这些参数传递 ...
- C# Split的用法,Split分割字符串
C# Split的用法,Split分割字符串 分割单个字串:string str="来自张三的亲切问候!;string[] strarry=str.Split(new string[] { ...
- Java中split的用法
Java中的我们可以利用split把字符串按照指定的分割符进行分割,然后返回字符串数组,下面是string.split的用法实例及注意事项:java.lang.string.splitsplit 方法 ...
- 条目二十八《正确理解由reverse_iterator的base()成员函数所产生的iterator的用法》
条目二十八<正确理解由reverse_iterator的base()成员函数所产生的iterator的用法> 迭代器的种类一共有四种,上面已经说过了.这里就不再次写出来. 这一个条目主要是 ...
- split的用法回顾,快忘记了@ →@
split:用for循环时不要忘记是数组名.length package com.aaa; //split的用法把指定的字符串按指定的分割符进行分割,然后返回字符串 数组 public class f ...
- mysql 函数GROUP_CONCAT(temp.amount SEPARATOR ',')的用法
mysql 函数GROUP_CONCAT(temp.amount SEPARATOR ',')的用法 使用场景:例如:想要查询用户的最喜欢购买的几种商品,这个时候就需要使用group_concat(字 ...
- python 中的split()函数和os.path.split()函数
Python中有split()和os.path.split()两个函数: split():拆分字符串.通过指定分隔符对字符串进行切片,并返回分割后的字符串列表. os.path.split():将文件 ...
- C++ 字符串的分割函数split 及 用法【转载】
文章出处https://blog.csdn.net/glmushroom/article/details/80690881 之前在C#中总用到字符串的分割,使用系统函数即可,比如: string a ...
- java分割函数split的用法(二)
package com.b; public class Sysetm { public static void main(String[] args) { String a=new String(&q ...
随机推荐
- 《安全智库》:48H急速夺旗大战通关writeup(通关策略)
作者:ByStudent 题目名字 题目分值 地址 MallBuilder2 350 mall.anquanbao.com.cn MallBuilder1 200 mall.anquanbao.c ...
- Makefile文件简单整理
.PHONY:clean main:hello.o gcc -o main hello.c hello.o:hello.c gcc -c hello.c clean: rm -f hello.o ma ...
- Web项目中创建简单的错误处理页面
当应用程序出现错误的时候,如果没有做错误页面处理的话,会直接输出一些敏感的信息出来,有时候甚至会直接将项目所在的物理路径给显示出来,严重缺乏安全性,并且错误种类繁多,页面风格不一,导致用户体验不好,本 ...
- 比Redis更快:Berkeley DB面面观
比Redis更快:Berkeley DB面面观 Redis很火,最近大家用的多.从两年前开始,Memcached转向Redis逐渐成为潮流:而Berkeley DB可能很多朋友还很陌生,首先,我们简单 ...
- shape into blocks--source code in python based on pySpark
这是微博深度和广度预测的原始代码,写了大约半个月,第一个版本不是这样的,但是这个版本包含所有需要的功能. 模块化的程度也更高.找工作前一直想用python完美解决这个问题,后来发现自己的方法和硬件都有 ...
- Typescript的面向对象
封装: var Greeter = (function () { function Greeter(message) { this.greeting = message; } Greeter.prot ...
- html 实时监控发送数据
我们都知道ajax可以做异步提交,可以从一个文件里得到返回的数据,如此便能够实时的得到数据,实时刷新页面,如下代码 setInterval(function(){ $.ajax({ url:'demo ...
- KaliLinux装好系统后安装常用软件
1.配置软件源 leafpad /etc/apt/source.list or(recommand):#官方源deb kali main non-free contribdeb-src kali ma ...
- Nginx基础知识之————日志管理
一.Server段,可以看到如下类似信息 #access_log logs/host.access.log main; 说明该server, 它的访问日志的文件是 logs/host.access. ...
- 11 半联结 & 反联结
半联结 和 反联结是 oracle 优化器能够选择用来在获取信息时应用的两个密切相关的联结方法(实际上是联结方法的选项) 半联结 IN 的半联结 select /* using in */ depar ...