「C#入門」AddRange()でリストをListへ追加するサンプル
説明
public void AddRange (System.Collections.Generic.IEnumerable<T> collection);
パラメーター
collection ...
「Java入門」Arrays.asList()を利用するサンプル
1.リストの定義
private static final List<String> cityList = Arrays.asList(“東京”,”大阪”,̶ ...
「Java入門」文字列(Strintg)から数値(long)へ変換するサンプル
サンプルコード
String productId= this.form.getProductId();Map<String,Object>cft=new HashMap<String,Object>(); ...「C#入門」インタフェース(interface)を実装するサンプル
サンプルコード
using System;/*インターフェイスの定義*/interface IParentInterface{ void ParentInterfaceMethod();}interface ITestInter ...「C言語」Switch文でenum値を出力するサンプル
サンプルコード
#include <stdio.h>#include <stdlib.h>int main(){ enum color { red=1, green, blue }; enum color ...「C言語」for文enumの要素をループするサンプル
サンプルコード
#include<stdio.h> enum DAY{ MON=1, TUE, WED, THU, FRI, SAT, SUN} day;int main(){//列挙型の要素 for (day = ...「C言語」列挙型(enum)を利用するサンプル
サンプルコード
#include<stdio.h> enum DAY{ MON=1, TUE, WED, THU, FRI, SAT, SUN}; int main(){ enum DAY day; day = WE ...「C言語」文字列をASCIIコードに変換するサンプル
サンプルコード
#include <stdio.h>int main(){ char c; printf("文字列を入力してください: ");//文字列の入力 scanf("%c", &c); printf( ...「C#入門」関数(メソッド)を定義するサンプル
サンプルコード
using System;namespace CalculatorApplication{ class NumberManipulator {/*関数の定義*/public int MaxVal(int num1 ...「C言語」breakでループから拔けるサンプル
サンプルコード
#include <stdio.h> int main(void){/* 変数の宣言 */int i;/* 繰り返し処理 */for(i=0;i<21;++i) { printf("値: %d\ ...「php言語」 getdate()で日付を取得するサンプル
サンプルコード
<?php$tt = getdate();echo "年:".$tt."<br/>\n";echo "月:".$tt."<br/>\n";echo "日:".$tt."<br/ ...「php言語」count関数で配列の値の数をカウントする
サンプルコード
<?php$kk = array("java", "php", "c++", "python","jquery"));echo count($kk) . "\n";?>結果
5 ...
「C言語」setlocale関数でロケールを設定するサンプル
サンプルコード
#include <stdio.h>#include <locale.h>int main(void){ char* tt = setlocale( LC_ALL, NULL ); put ...「C言語」acos()関数で逆余弦を計算するサンプル
サンプルコード
#include <stdio.h>#include <math.h>#define PI 3.14159265int main (){ double x, ret, cft; x = 0 ...「C言語」setlocale関数でロケールを設定するサンプル
サンプルコード
#include <locale.h>#include <stdio.h>#include <time.h> int main (){ time_t currtime; str ...「php言語」ファイルへテキストを書き込むサンプル
サンプルコード
<?php//ファイルを開く$fp = fopen("demo.txt", "w");//ファイルへ書き込みfwrite($fp, "test data1*\n");fwrite($fp, "test da ...「C言語」標準ヘッダlimits.hの定義マクロ
サンプルコード
#include <stdio.h>#include <limits.h>int main(){ printf("The number of bits in a byte %d\n", C ...「C言語」intからdoubleへの型のキャストをするサンプル
サンプルコード
#include <stdio.h> int main(){ int sum = 17, count = 5; double tt; tt = (double) sum/count; printf(" ...