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 ...
随机推荐
- jQuery 预习视频
1.事件补充 <input type="button" onclick="CheckAll('#edit_mode','#tb1');" value=&q ...
- win8和ubuntu双系统安装
做了一个windows和Ubuntu双系统,参考了一些文章.网上资料不少,我就不重复了. 虽然没什么难度,但是有些细节在装的时候需要注意.不然造成资料丢失,系统崩溃,你就得不偿失,需要折腾花费较长的时 ...
- nyoj 1058部分和问题(DFS)
部分和问题 时间限制:1000 ms | 内存限制:65535 KB 难度:2 描述 给定整数a1.a2........an,判断是否可以从中选出若干数,使它们的和恰好为K. 输入 首先, ...
- fFFmpeg 命令、案例、测试集中营
gitbook: https://www.gitbook.com/book/xdsnet/other-doc-cn-ffmpeg/details ffmpeg [全局选项] {[输入文件选项] -i ...
- python把元组组合成字典
list=((","16g"), (","32g"), (","red"), (","bl ...
- white-space: nowrap
CSS:需要加上宽度(width:100px).超出隐藏(overflow:hidden;).强制在同一行显示(white-space: nowrap;).省略号(text-overflow:elli ...
- vim 学习记录
VIM中PHP代码使用tab键自动完成 更新于 2013-01-18 05:47:55UEANER 目录结构 $ tree -C ~/.vim | grep -v ".cnx" | ...
- MySQL之聚合
EP:巧妙地过滤掉重复的日期 example:使用bit_or() bit_count()巧妙地过滤掉重复的日期: CREATE TABLE t1 ( year YEAR(4), month INT( ...
- 通过yum安装nginx-mysql-php-fastcgi配置LNMP
最近指想服务器跑静态文件,所以想单独配置个nginx的webserver,然而并不是我想象的那么简单,使用rpm包来安装会发生很多软件依赖的错误: 当我尝试使用yum安装nginx的时候,总是提示未找 ...
- (x&y) + ((x^y)>>1)即x和y的算数平均值
(x&y) + ((x^y)>>1)相当于(x+y)/2 (x&y)+((x^y)>>1),把x和y里对应的每一位(指二进制位)都分成三类,每一类分别计算平均值 ...