diff --git a/calculator223a5019.sln b/calculator223a5019.sln new file mode 100644 index 0000000..9517b4e --- /dev/null +++ b/calculator223a5019.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.9.34622.214 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "calculator223a5019", "calculator223a5019\calculator223a5019.vcxproj", "{8A7C9901-B43C-4050-B7AE-40248762DB0A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8A7C9901-B43C-4050-B7AE-40248762DB0A}.Debug|x64.ActiveCfg = Debug|x64 + {8A7C9901-B43C-4050-B7AE-40248762DB0A}.Debug|x64.Build.0 = Debug|x64 + {8A7C9901-B43C-4050-B7AE-40248762DB0A}.Debug|x86.ActiveCfg = Debug|Win32 + {8A7C9901-B43C-4050-B7AE-40248762DB0A}.Debug|x86.Build.0 = Debug|Win32 + {8A7C9901-B43C-4050-B7AE-40248762DB0A}.Release|x64.ActiveCfg = Release|x64 + {8A7C9901-B43C-4050-B7AE-40248762DB0A}.Release|x64.Build.0 = Release|x64 + {8A7C9901-B43C-4050-B7AE-40248762DB0A}.Release|x86.ActiveCfg = Release|Win32 + {8A7C9901-B43C-4050-B7AE-40248762DB0A}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {8DFCE0B1-F285-450C-A7F8-F914A842DE96} + EndGlobalSection +EndGlobal diff --git a/calculator223a5019/Calculator.cpp b/calculator223a5019/Calculator.cpp new file mode 100644 index 0000000..4bf15dd --- /dev/null +++ b/calculator223a5019/Calculator.cpp @@ -0,0 +1,18 @@ +#include "Calculator.h" + +double Calculator::Calculate(double x, char oper, double y) +{ + switch (oper) + { + case '+': + return x + y; + case '-': + return x - y; + case '*': + return x * y; + case '/': + return x / y; + default: + return 0.0; + } +} diff --git a/calculator223a5019/Calculator.h b/calculator223a5019/Calculator.h new file mode 100644 index 0000000..67d37be --- /dev/null +++ b/calculator223a5019/Calculator.h @@ -0,0 +1,7 @@ +#pragma once +class Calculator +{ +public: + double Calculate(double x, char oper, double y); +}; + diff --git a/calculator223a5019/calculator223a5019.cpp b/calculator223a5019/calculator223a5019.cpp new file mode 100644 index 0000000..0406e44 --- /dev/null +++ b/calculator223a5019/calculator223a5019.cpp @@ -0,0 +1,40 @@ +// calculator223a5019.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。 +// + +#include +#include "Calculator.h" + +using namespace std; + +int main() +{ + double x = 0.0; + double y = 0.0; + double result = 0.0; + char oper = '+'; + + cout << "Calculator Console Application" << endl << endl; + cout << "Please enter the operation to perform. Format: a+b | a-b | a*b | a/b" + << endl; + + Calculator c; + while (true) + { + cin >> x >> oper >> y; + result = c.Calculate(x, oper, y); + cout << "Result " << "of " << x << oper << y << " is: " << result << endl; + } + + return 0; +} + +// プログラムの実行: Ctrl + F5 または [デバッグ] > [デバッグなしで開始] メニュー +// プログラムのデバッグ: F5 または [デバッグ] > [デバッグの開始] メニュー + +// 作業を開始するためのヒント: +// 1. ソリューション エクスプローラー ウィンドウを使用してファイルを追加/管理します +// 2. チーム エクスプローラー ウィンドウを使用してソース管理に接続します +// 3. 出力ウィンドウを使用して、ビルド出力とその他のメッセージを表示します +// 4. エラー一覧ウィンドウを使用してエラーを表示します +// 5. [プロジェクト] > [新しい項目の追加] と移動して新しいコード ファイルを作成するか、[プロジェクト] > [既存の項目の追加] と移動して既存のコード ファイルをプロジェクトに追加します +// 6. 後ほどこのプロジェクトを再び開く場合、[ファイル] > [開く] > [プロジェクト] と移動して .sln ファイルを選択します diff --git a/calculator223a5019/calculator223a5019.vcxproj b/calculator223a5019/calculator223a5019.vcxproj new file mode 100644 index 0000000..4b30c63 --- /dev/null +++ b/calculator223a5019/calculator223a5019.vcxproj @@ -0,0 +1,139 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + Win32Proj + {8a7c9901-b43c-4050-b7ae-40248762db0a} + calculator223a5019 + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + + + + + \ No newline at end of file diff --git a/calculator223a5019/calculator223a5019.vcxproj.filters b/calculator223a5019/calculator223a5019.vcxproj.filters new file mode 100644 index 0000000..c790e5d --- /dev/null +++ b/calculator223a5019/calculator223a5019.vcxproj.filters @@ -0,0 +1,30 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + ソース ファイル + + + ソース ファイル + + + + + ヘッダー ファイル + + + \ No newline at end of file