C言語で文字列を逆にするサンプル
サンプルコード
#include <stdio.h>void reverseSentence(); int main(){ printf("文字列を入力してください: "); reverseSentence(); r ...「C言語」fgets関数でファイルを読み込むサンプル
サンプルコード
#include <stdio.h> int main(){ FILE *fp = NULL; char buff; fp = fopen("/tmp/test.txt", "r"); fscanf( ...「C言語」fputs関数の使い方
サンプルコード
#include <stdio.h> int main(){ FILE *fp = NULL; fp = fopen("/tmp/demo.txt", "w+"); fprintf(fp, "This ...「C言語」アルファベット(A to Z)の連続を出力するサンプル
サンプルコード
#include <stdio.h> int main(){ char c; for(c = 'A'; c <= 'Z'; ++c) printf("%c ", c); return 0;}「C言語」配列の最大値を探すサンプル
サンプルコード
#include <stdio.h> int main() { int array = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0}; int loop, largest; large ...「C言語」union共用体の使い方
サンプルコード
#include <stdio.h>#include <string.h> union Data{ int i; float f; char str;}; int main( ){ uni ...「C言語」struct構造体の使い方
サンプルコード
#include <stdio.h>struct Books{ char title; char author; char subject; int book_id;} book = {"C言語入門" ...「C言語」continueで繰り返し処理のループをスキップするサンプル
サンプルコード
#include <stdio.h> int main (){/* 変数の宣言 */int a = 10;/* do ループ*/do { if( a == 15) {//ループをスキップ a = a ...「C言語」typedef struct による構造体の定義サンプル
サンプルコード
#include <stdio.h>#include <string.h> typedef struct Books{ char title; char author; char subj ...「C言語」gets()とputs()関数の使い方
サンプルコード
#include <stdio.h> int main( ){ char str; printf( "Enter a value :"); gets( str ); printf( "\nYou en ...「C言語」フィボナッチ数を計算するサンプル
サンプルコード
#include <stdio.h> int fibonaci(int i){ if(i == 0) { return 0; } if(i == 1) { return 1; } return fib ...「C言語」条件演算子でmax()関数を実現するサンプル
サンプルコード
#include <stdio.h>int maxFunc(int a, int b) { return a > b ? a : b; }int main(void) { printf(" ...「Python」re.match()のサンプルコード
re.match()
文字列の先頭がパターンにマッチするかどうかを調べる。
サンプルコード
#!/usr/bin/python3import reline = "Cats are smarter than d ...「C言語」論理演算子(&&, ||)を利用するサンプル
サンプルコード
#include <stdio.h> int main(){ int a = 5; int b = 20; int c ; if ( a && b ) { printf("Line 1 ...「C言語」a++と++a演算子を利用するサンプル
サンプルコード
#include <stdio.h> int main(){ int c; int a = 10; c = a++; printf("a++計算結果:\n"); printf("Line 1 - c ...「Vue.js」v-bind:class の使い方
サンプルコード
<style>.classA{ background: #444; color: #eee;}</style><script src="vue.min.js"></scr ...Collections.sort()で数値を降順にするサンプルコード
サンプルコード
package com.arkgame;import java.util.ArrayList;import java.util.Collections;import java.util.List;public c ...「C言語」配列を初期化するサンプルコード
サンプルコード
#include <stdio.h>int main(void) {//初期化 int cftA = { 41, 42, 43 }; for (int i = 0; i < 3; ++i) { ...