dynamic-arrays

    0熱度

    2回答

    簡單地說 - 我開始在C#中,並且我正在嘗試製作一個遊戲(基於文本),計算機生成一個介於20之間的數字-30。然後,用戶從1-3開始採集一個數字,然後計算機從1-3開始計算一個數字,最後一個人拿走一個數字,使其失去0。 我的問題是 - 我想爲用戶答案設置一個數組,但我無法弄清楚如何根據用戶完成遊戲需要多少輪來向數組添加元素。例如。他們可以投入很多時間並花費時間 - 爲陣列增加許多元素,或者他們可以

    -3熱度

    1回答

    在PHP中,我的數組如下所示。 Array ([0] => Array ([ReasonCode] => TS) [1] => Array ([ReasonCode] => TS3) [2] => Array ([ReasonCode] => TS4) [3] => Array ([ReasonCode] => TEST-OO1) [4] => Array ([ReasonCode] => ROO

    -1熱度

    1回答

    具有這種類型的結構,如何將一個結構複製到另一個結構中。我宣稱Array first和Array second,然後我啓動了兩個,並在每一個不同的數據。 然後複製first到second我試過second = first但它不起作用。 我該怎麼辦? #include <stdio.h> #include <stdlib.h> #include <inttypes.h>

    -1熱度

    1回答

    我需要基於count在運行時動態創建數組。例如,如果我有一個源陣列sourcearr = ['arr1','arr2','arr3','arr4'],sourcearr的元件的計數爲4即var count = sourcearr.length,我需要是這樣的: for(i=0;i<count;i++) { //define 4 dynamic arrays here //ba

    0熱度

    1回答

    我正在C++中製作一個模板化的矩陣類。爲了創建這個類,我創建了一個指針數組,這些指針指向動態數組。 到目前爲止,我有: template<typename T> class Matrix { public: //constructor int **m = new int*[_rows]; for (int i = 0; i < _rows;

    0熱度

    2回答

    爲什麼這樣的: Dim Arr As Variant p = 1 For i = 1 To LRow If Sheets("Data").Range("U" & 4 + i).Value > 0 Then ReDim Preserve Arr(1 To p, 1 To 2) Arr(p, 1) = Sheets("Data").Range("U" & 4 + i).Val

    0熱度

    2回答

    我得到的錯誤,當我嘗試創建ContestantInfo *contestantStructArray = new ContestantInfo [numberOfContestants]; 繼承人我的代碼「不完全類型的分配」: #include <fstream> #include <iostream> using namespace std; struct ContestantInfo

    -1熱度

    1回答

    我在嘗試從文件讀取到二維動態數組時遇到段錯誤。我知道這是一個含糊不清的問題,但這是我的第一個C代碼,我一直無法找出問題所在。任何方向將不勝感激。 這些是我的變量: int i; int rowsize=0; int colsize=0; int colenter=0; int rowenter=0; int colexit=0; int

    -1熱度

    2回答

    現在我試圖動態分配幾個名稱到一個使用namePlayers函數的結構數組中。然而,當我嘗試編譯我得到這個錯誤: |39|error: no matching function for call to 'namePlayers' #include <iostream> #include <cstdlib> #include <cmath> using namespace std; str

    0熱度

    1回答

    我正在爲一個類(已提交)做一個項目,但是當初始化int 2D動態數組時,讀取訪問衝突仍然困擾着我,我不知道是什麼原因造成的它。 class kMeans { public: //xyCoord struct struct xyCoord { int Label; int xCoordinate; int yCoordinate;