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的用法的更多相关文章

  1. 表值函数与JS中split()的联系

    在公司用云平台做开发就是麻烦 ,做了很多功能或者有些收获,都没办法写博客,结果回家了自己要把大脑里面记住的写出来. split()这个函数我们并不陌生,但是当前台有许多字段然后随意勾选后的这些参数传递 ...

  2. C# Split的用法,Split分割字符串

    C# Split的用法,Split分割字符串 分割单个字串:string str="来自张三的亲切问候!;string[] strarry=str.Split(new string[] { ...

  3. Java中split的用法

    Java中的我们可以利用split把字符串按照指定的分割符进行分割,然后返回字符串数组,下面是string.split的用法实例及注意事项:java.lang.string.splitsplit 方法 ...

  4. 条目二十八《正确理解由reverse_iterator的base()成员函数所产生的iterator的用法》

    条目二十八<正确理解由reverse_iterator的base()成员函数所产生的iterator的用法> 迭代器的种类一共有四种,上面已经说过了.这里就不再次写出来. 这一个条目主要是 ...

  5. split的用法回顾,快忘记了@ →@

    split:用for循环时不要忘记是数组名.length package com.aaa; //split的用法把指定的字符串按指定的分割符进行分割,然后返回字符串 数组 public class f ...

  6. mysql 函数GROUP_CONCAT(temp.amount SEPARATOR ',')的用法

    mysql 函数GROUP_CONCAT(temp.amount SEPARATOR ',')的用法 使用场景:例如:想要查询用户的最喜欢购买的几种商品,这个时候就需要使用group_concat(字 ...

  7. python 中的split()函数和os.path.split()函数

    Python中有split()和os.path.split()两个函数: split():拆分字符串.通过指定分隔符对字符串进行切片,并返回分割后的字符串列表. os.path.split():将文件 ...

  8. C++ 字符串的分割函数split 及 用法【转载】

    文章出处https://blog.csdn.net/glmushroom/article/details/80690881 之前在C#中总用到字符串的分割,使用系统函数即可,比如: string a ...

  9. java分割函数split的用法(二)

    package com.b; public class Sysetm { public static void main(String[] args) { String a=new String(&q ...

随机推荐

  1. 基于ADL5317的雪崩光电二极管(APD)偏压控制/光功率监测电路的设计

    1 引言 目前,雪崩光电二极管(APD)作为一种高灵敏.能精确接收数据和测量光功率的光探测器件广泛应用于光纤传感.光纤通信网络中.它借助于内部强电场作用产生雪崩倍增效应,具有极高的内部增益(可达102 ...

  2. wince下的CPU和内存占用率计算

    #include <Windows.h> DWORD Caculation_CPU(LPVOID lpVoid) { MEMORYSTATUS MemoryInfo; DWORD Perc ...

  3. MusigCV安装

    首先,将下载的安装文件zip包,http://www.mathworks.com/products/compiler/mcr/ MCR2013a 然后依次执行下面的命令: 进入目录:cd /tmp 解 ...

  4. ubuntu下卸载vmware

    直接crl+alt+t打开一个terminal,然后输入sudo vmware-installer --uninstall-product vmware-workstation即可卸载!操作如下图: ...

  5. hdu 4883 思维题

    链接:http://acm.hdu.edu.cn/showproblem.php?pid=4883 TIANKENG’s restaurant Time Limit: 2000/1000 MS (Ja ...

  6. x名称空间

    XAML代码的WPF程序都需要通过语句:xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml",x就是用来映射xmlns:x= ...

  7. AngularJS Protractor

    官网地址:http://www.protractortest.org/ 1. 预备环境 protractor 是一个 Node.js 程序,为了运行 protractor ,你首先需要 Node 环境 ...

  8. intanceof以及引出的__proto__和prototype

    instanceof运算代码 function instance_of(L, R) { //L 表示左表达式,R 表示右表达式 var O = R.prototype; // 取 R 的显示原型 L ...

  9. cocos2d-x 3.X (二)创建动起来的精灵

    [参考文章]http://www.cnblogs.com/suguoqiang/archive/2013/04/03/2997316.html 在HelloWorldScene.h中声明void ro ...

  10. iOS - Swift Subscript 下标脚本

    1.Subscript 下标脚本允许你通过在实例后面的方括号中传入一个或者多个的索引值来对实例进行访问和赋值.语法类似于实例方法和计算型属性的混合.与定义实例方法类似,定义下标脚本使用 subscri ...