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. run a Freight robot (3)

    5.Logging In Once the robot is turned on and the robot is on the network, ssh into the computer of t ...

  2. 转 Cocos网络篇[3.2](3) ——Socket连接(1)

    Cocos网络篇[3.2](3) ——Socket连接(1) 2015-03-05 22:24:13 标签:network http socket cocos [唠叨] 在客户端游戏开发中,使用HTT ...

  3. 美团网基于机器学习方法的POI品类推荐算法

    美团网基于机器学习方法的POI品类推荐算法 前言 在美团商家数据中心(MDC),有超过100w的已校准审核的POI数据(我们一般将商家标示为POI,POI基础信息包括:门店名称.品类.电话.地址.坐标 ...

  4. 关于ASP.NET的web.config的小笔记

    在ASP和MVC开发中,有一些参数是需要活动更改的,最常见的就是数据库的链接字符串<connectionStrings>节点下配置的.在今天接触的项目中,我又接触到了自定义配置参数,就是可 ...

  5. python多线程下载

    # -*- coding=utf-8 -*- import sys import os import os.path import time import urllib.request, urllib ...

  6. Android 让输入框输入指定字符的办法

    让输入框输入指定字符的办法 有一个需求 让输入密码的时候只能输入数字字母可见字符 不能输入中文 之前还以为要写代码 还来发现有一个属性可以直接实现 <EditText android:layou ...

  7. 在Spring Data JPA 中使用Update Query更新实体类

    对于 Spring Data JPA 使用的时间不长,只有两年时间.但是踩过坑的却不少. 使用下列代码 @Modifying @Query("update User u set u.firs ...

  8. [转]Oracle中INITRANS和MAXTRANS参数

    每个块都有一个块首部.这个块首部中有一个事务表.事务表中会建立一些条目来描述哪些事务将块上的哪些行/元素锁定.这个事务表的初始大小由对象的INITRANS 设置指定.对于表,这个值默认为2(索引的IN ...

  9. static final的理解

    static: static静态,可以修饰类,成员变量,成员方法,代码块.static修饰的成员变量和方法独立于该类的任何对象,也就是被类的所有成员共享,这要这个类被加载,虚拟机就能根据类名在运行时数 ...

  10. Jni的一个异常

    UnsatisfiedLinkError:No implementation found for java.lang.String com.skymaster.hs.test4.MainActivit ...