「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(" ...「C言語」for文で配列の要素を出力するサンプル
サンプルコード
int main(void) { int i; int a = {13, 14, 15,16,17};/* 配列の要素を出力 */for(i=0;i<5;++i){ printf("%d\n", a); } ...「C言語」for文で多次元配列の要素を出力するサンプル
サンプルコード
#include <stdio.h>
int main(void) {
int i, j;
int a = {106, 107, 108, 109};
「C言語」配列の要素を取得するサンプル
サンプルコード
#include <stdio.h>
int main ()
{
int n;
int i,j;
/* 初期化*/
for ( i = 0; ...