小编Kha*_*lid的帖子

用于创建文件夹的批处理文件,增量文件夹名称为Name 1,Name 2,

有谁知道如何创建一个批处理文件,在一个目录中创建文件夹,增量名称为"问题1","问题2",...

powershell batch-file

3
推荐指数
1
解决办法
4134
查看次数

找到间接列车连接

我必须在两个给定的城市代码之间找到火车旅程,如果没有直接路线,那么我应该通过其他旅程找到间接路线.如果我想从A到B,我可能不得不从A到C到B.

我的火车路线文件格式为:出发码目的地代码公司价格时间这是两个城市代码之间的直接路线.

现在我使用以下循环进行直接连接,它可以工作,我只需要间接连接的帮助.

// load file data into v1

string dep, dest;
cout << "\n\tEnter the departure: ";
cin >> dep;
cout << "\n\tEnter the destination: ";
cin >> dest;

for(int i = 0; i < v1.size(); ++i) {
    // Departure() and Destination(), return the departure/destination codes
    if (v1[i].Departure() == dep && v1[i].Destination() == dest)
          // here I find all the direct routes
    else
         // indirect routes dealt with here
}
Run Code Online (Sandbox Code Playgroud)

我认为对于间接路线,我必须在其他部分处理它们.但我很难看到我会怎么做,我想我必须看看第一个出发地的目的地,并将其与我给定的目的地相匹配.

c++ loops

2
推荐指数
1
解决办法
595
查看次数

立方根猜谜游戏

我正在制作一个简单的立方根猜测游戏,其中生成随机并显示它的立方体,然后用户输入立方根.这是我的计划:

int main()
try {
    int max, min;
    max = 99; min = 1; // only cubes of 1-99 are displayed

    // display the title
    cout << "\n\t\t\t\tCube Root Game" << endl;
    cout << "\t\t\t\t=============\n" << endl;
    srand(time(0)); // seed for random number generator

    // display 10 numbers for the user to guess the cube root
    for (int i = 0; i < 10; i++) {      
        int answer; // answer inputted by the user
        int temp = rand() % (max …
Run Code Online (Sandbox Code Playgroud)

c++

2
推荐指数
1
解决办法
265
查看次数

PHP - 表单动作调用自身,如何在1页中显示所有内容?

我有两个.php文件:

test1.php

<html>
<head>
    <title>Sample</title>
</head>
<body>
    <form action="test2.php" method="post">
        Please enter a number <input type="number" name="userNumber"><br>
        <input type="submit">
    </form>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

test2.php

<html>
<head>
    <title>Sample Display Page</title>
</head>
<body>
<?php   
    $user_number = $_POST["userNumber"];
    echo "You have chosen $user_number";    
?>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

我想知道如何才能将它全部显示在单个页面上,即在test1.php上,而不必拥有两个文件.

html php forms

1
推荐指数
2
解决办法
1万
查看次数

Java - 我的排序不起作用

我创建了以下类来对字符串数组进行排序.

public class StringSort {
private String[] hotelNames;
private int arrayLength;

public void sortHotel(String[] hotelArray) {
    if (hotelArray.length <= 1) {
        return;
    }
    this.hotelNames = hotelArray;
    arrayLength = hotelArray.length;
    quicksort(0, arrayLength - 1);
}

private void quicksort(int low, int high) {
    int i = low, j = high;
    String first = hotelNames[low];
    String last = hotelNames[high];     
    String pivot = hotelNames[low + (high - low) / 2];

    while( (first.compareTo(last)) < 0 ) { // first is less than last
        while( (hotelNames[i].compareTo(pivot)) …
Run Code Online (Sandbox Code Playgroud)

java

0
推荐指数
1
解决办法
104
查看次数

标签 统计

c++ ×2

batch-file ×1

forms ×1

html ×1

java ×1

loops ×1

php ×1

powershell ×1