Skip to content

Instantly share code, notes, and snippets.

View sdkfz181tiger's full-sized avatar
👾

Kajiru sdkfz181tiger

👾
View GitHub Profile
@sdkfz181tiger
sdkfz181tiger / main_23.cpp
Last active May 18, 2024 05:13
C/C++課題ネタ10_文字列の操作
//==========
// 数値から文字列への変換
// 1, Compile
// g++ -std=c++17 -Wall -Wextra main.cpp
// 2, Run
// ./a.out
#include <math.h>
#include <stdio.h>
#include <string>
@sdkfz181tiger
sdkfz181tiger / main_19.cpp
Last active May 17, 2024 14:12
C/C++課題ネタ09_テンプレートx可変長引数
//==========
// 任意個数の要素をコンテナに追加
// 1, Compile
// g++ -std=c++17 -Wall -Wextra main.cpp
// 2, Run
// ./a.out
#include <math.h>
#include <stdio.h>
#include <vector>
@sdkfz181tiger
sdkfz181tiger / Mtx3xX.cpp
Last active May 17, 2024 22:17
C/C++課題ネタ08_マトリクス演算クラス(演算子オーバーロード)
#include "Mtx3xX.h"
bool Mtx3x3::operator==(const Mtx3x3 &rhs) const{
for(size_t r=0; r<size; r++){
for(size_t c=0; c<size; c++){
if(mtx[r][c] != rhs.mtx[r][c]) return false;
}
}
return true;
}
@sdkfz181tiger
sdkfz181tiger / Vec2.cpp
Last active May 17, 2024 22:16
C/C++課題ネタ07_ベクトル演算クラス(演算子オーバーロード)
#include "Vec2.h"
Vec2 Vec2::operator+(const Vec2 &vec) const {
return Vec2(x + vec.x, y + vec.y);
}
Vec2 &Vec2::operator+=(const Vec2 &vec) {
x += vec.x;
y += vec.y;
@sdkfz181tiger
sdkfz181tiger / main_01.cpp
Last active May 15, 2024 06:31
C/C++課題ネタ06_関数テンプレート、クラステンプレート
//==========
// テンプレート(関数テンプレート)
// 1, Compile
// g++ -std=c++17 -Wall -Wextra main.cpp
// 2, Run
// ./a.out
#include <math.h>
#include <stdio.h>
@sdkfz181tiger
sdkfz181tiger / main_01.cpp
Created May 15, 2024 06:23
C/C++課題ネタ05_演算子オーバーロード
//==========
// 演算子オーバーロード
// 1, Compile
// g++ -std=c++17 -Wall -Wextra main.cpp
// 2, Run
// ./a.out
#include <math.h>
#include <stdio.h>
@sdkfz181tiger
sdkfz181tiger / main_14.cpp
Last active May 13, 2024 13:31
C/C++課題ネタ04_IPv4クラス
//==========
// IPv4データ型
// 1, Compile
// g++ -std=c++17 -Wall -Wextra main.cpp
// 2, Run
// ./a.out
#include <math.h>
#include <sstream>
#include <stdio.h>
@sdkfz181tiger
sdkfz181tiger / main_11.cpp
Last active May 13, 2024 06:31
C/C++課題ネタ03_ローマ数字、コラッツ数列、円周率、ISBN-10
//==========
// ローマ数字に変換
// 1, Compile
// g++ -std=c++17 -Wall -Wextra main.cpp
// 2, Run
// ./a.out
#include <math.h>
#include <stdio.h>
#include <string>
@sdkfz181tiger
sdkfz181tiger / main_06.cpp
Last active May 13, 2024 06:30
C/C++課題ネタ02_過剰数、友愛数、アームストロング数、素因数分解、グレイコード
//==========
// 過剰数か判定する
// 1, Compile
// g++ -std=c++17 -Wall -Wextra main.cpp
// 2, Run
// ./a.out
#include <math.h>
#include <stdio.h>
@sdkfz181tiger
sdkfz181tiger / main_00.cpp
Last active May 13, 2024 06:29
C/C++課題ネタ01_割り切れる数、最大公約数、最小公倍数、素数判定
//==========
// HowTo C++
// 1, Compile
// g++ -std=c++17 -Wall -Wextra main.cpp
// 2, Run
// ./a.out
#include <math.h>
#include <stdio.h>