小编Dan*_*ett的帖子

在while循环中设置条件

我有以下C#源代码:

public static bool PeulaRashit()
{
    int days;
    double totalPayForService;

    Console.WriteLine("Enter number of days");
    days = int.Parse(Console.ReadLine()); 
    if (days== 999)
        return false;
    totalPayForService = TotalService(days);
    TotalPyament(totalPayForService, days);
    return true;
}

static void Main(string[] args)
{
    while (.....) //what should I do here?
    {}
}
Run Code Online (Sandbox Code Playgroud)

我想要PeulaRashit重复该方法,直到它false.我的问题是它应该是什么条件while才会发生?

c# while-loop

-1
推荐指数
1
解决办法
114
查看次数

PHP数组for循环

我想$result[]for循环计算中显示数组值.但是,它在页面上没有显示任何内容.以下代码有什么问题吗?

$sql= "SELECT * FROM items where itemID =3 ";
$result1= mysql_query($sql) or die (mysql_error());
while ($row= mysql_fetch_array($result1)){

    $quantity[] = $row ['quantity'];

    $month[] = $row ['month'];
}

$alpha = 0.3;

for($i = 1; $i > 12; $i++){

    $result[$i] = ($quantity[$i] - $result[$i-1]) * $alpha + $result[$i-1];

}

foreach ($result as $key => $value ){

 echo "$value";

}
Run Code Online (Sandbox Code Playgroud)

php

-1
推荐指数
1
解决办法
103
查看次数

如何在数字的最后2位前插入小数点?

123457例如,我有一个号码.我要这个:1234.57

我试图用format_number,round()等等,但它不工作.

我怎样才能做到这一点?

php

-1
推荐指数
1
解决办法
4673
查看次数

除了第一个和最后一个<tr>之外,我如何定位<td>和<th>?

我怎么可以针对一些子元素,除了在母公司是第一个或最后一个孩子家长吗?

请参阅我的CSS中的评论,以便更好地了解我的意思.

CSS:

/* Always apply */
tr th, tr td
{
    text-align: left;
    vertical-align: top;
}

/* Apply to all except first <tr> */
tr th, tr td
{
    padding-top: 5px;
}

/* Apply to all except last <tr> */
tr th, tr td
{
    border-bottom: 1px solid #c4c4c4;
    padding-bottom: 5px;
}
Run Code Online (Sandbox Code Playgroud)

HTML:

<table>
    <tr>
        <th>Born</th>
        <td><time datetime="1986-11-05">5<sup>th</sup> November 1986</time></td>
    </tr>
    <tr>
        <th>Gender</th>
        <td>Male</td>
    </tr>
    <tr>
        <th>Sports</th>
        <td>Football<br />Tennis</td>
    </tr>
    <tr>
        <th>Teams</th>
        <td>Liverpool FC<br />Spain …
Run Code Online (Sandbox Code Playgroud)

css css-selectors css3

-4
推荐指数
1
解决办法
4378
查看次数

标签 统计

php ×2

c# ×1

css ×1

css-selectors ×1

css3 ×1

while-loop ×1