From 441c2ab363b9cfb49b72bfb4cbe24951e9c29b52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mert=20G=C3=B6r?= Date: Sun, 23 Jun 2024 22:32:48 +0300 Subject: [PATCH] examples from C++ Primer but with own mind/consciousness --- src/.gitignore | 94 +++++++++++++++++++++++++++++++++++++++++++++++ src/calculate.cpp | 12 ++++++ src/hello.cpp | 8 ++++ 3 files changed, 114 insertions(+) create mode 100644 src/.gitignore create mode 100644 src/calculate.cpp create mode 100644 src/hello.cpp diff --git a/src/.gitignore b/src/.gitignore new file mode 100644 index 0000000..664720f --- /dev/null +++ b/src/.gitignore @@ -0,0 +1,94 @@ +# Created by https://www.toptal.com/developers/gitignore/api/emacs +# Edit at https://www.toptal.com/developers/gitignore?templates=emacs + +### Emacs ### +# -*- mode: gitignore; -*- +*~ +\#*\# +/.emacs.desktop +/.emacs.desktop.lock +*.elc +auto-save-list +tramp +.\#* + +# Org-mode +.org-id-locations +*_archive + +# flymake-mode +*_flymake.* + +# eshell files +/eshell/history +/eshell/lastdir + +# elpa packages +/elpa/ + +# reftex files +*.rel + +# AUCTeX auto folder +/auto/ + +# cask packages +.cask/ +dist/ + +# Flycheck +flycheck_*.el + +# server auth directory +/server/ + +# projectiles files +.projectile + +# directory configuration +.dir-locals.el + +# network security +/network-security.data + + +# End of https://www.toptal.com/developers/gitignore/api/emacs + +# Created by https://www.toptal.com/developers/gitignore/api/c++ +# Edit at https://www.toptal.com/developers/gitignore?templates=c++ + +### C++ ### +# Prerequisites +*.d + +# Compiled Object files +*.slo +*.lo +*.o +*.obj + +# Precompiled Headers +*.gch +*.pch + +# Compiled Dynamic libraries +*.so +*.dylib +*.dll + +# Fortran module files +*.mod +*.smod + +# Compiled Static libraries +*.lai +*.la +*.a +*.lib + +# Executables +*.exe +*.out +*.app + +# End of https://www.toptal.com/developers/gitignore/api/c++ diff --git a/src/calculate.cpp b/src/calculate.cpp new file mode 100644 index 0000000..b9a5083 --- /dev/null +++ b/src/calculate.cpp @@ -0,0 +1,12 @@ +#include + +int main() +{ + std::cout << "enter two numbers:" << std::endl; + int value1 = 0, value2 = 0; + std::cin >> value1 >> value2; + std::cout << "The sum of " << value1 << " and " << value2 + << " is " << value1 + value2 << std::endl; + + return 0; +} diff --git a/src/hello.cpp b/src/hello.cpp new file mode 100644 index 0000000..3e72591 --- /dev/null +++ b/src/hello.cpp @@ -0,0 +1,8 @@ +#include + +int main() +{ + std::cout << "Hello World of C++\n"; + + return 0; +}