This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func test_array( N:Int, num:Int ) -> Int { | |
// 長さNの配列を用意し0で初期化 | |
var array = Array<Int>(repeating:0,count:N) | |
// 各要素にnumを代入 | |
for i in 0..<N { | |
array[i] = num | |
} | |
// 各要素の和を計算 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
#include <string> | |
int test_array( const int N, const int num ) { | |
// 長さNの配列を用意 | |
int *array = new int[N]; | |
int sum = 0; | |
// 0で初期化 |
NewerOlder