Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 25cad6c

Browse files
committed
first commit
0 parents  commit 25cad6c

File tree

24 files changed

+556
-0
lines changed

24 files changed

+556
-0
lines changed

.DS_Store

6 KB
Binary file not shown.

.vscode/settings.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"files.associations": {
3+
"iosfwd": "cpp"
4+
}
5+
}

.vscode/tasks.json

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"tasks": [
3+
{
4+
"type": "cppbuild",
5+
"label": "C/C++: clang++ build active file",
6+
"command": "/usr/bin/clang++",
7+
"args": [
8+
"-fcolor-diagnostics",
9+
"-fansi-escape-codes",
10+
"-g",
11+
"${file}",
12+
"-o",
13+
"${fileDirname}/${fileBasenameNoExtension}"
14+
],
15+
"options": {
16+
"cwd": "${fileDirname}"
17+
},
18+
"problemMatcher": [
19+
"$gcc"
20+
],
21+
"group": {
22+
"kind": "build",
23+
"isDefault": true
24+
},
25+
"detail": "Task generated by Debugger."
26+
}
27+
],
28+
"version": "2.0.0"
29+
}

cpp_calculator/.DS_Store

6 KB
Binary file not shown.

cpp_calculator/.vscode/settings.json

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
{
2+
"files.associations": {
3+
"__bit_reference": "cpp",
4+
"__bits": "cpp",
5+
"__config": "cpp",
6+
"__debug": "cpp",
7+
"__errc": "cpp",
8+
"__hash_table": "cpp",
9+
"__locale": "cpp",
10+
"__mutex_base": "cpp",
11+
"__node_handle": "cpp",
12+
"__nullptr": "cpp",
13+
"__split_buffer": "cpp",
14+
"__string": "cpp",
15+
"__threading_support": "cpp",
16+
"__tuple": "cpp",
17+
"array": "cpp",
18+
"atomic": "cpp",
19+
"bit": "cpp",
20+
"bitset": "cpp",
21+
"cctype": "cpp",
22+
"chrono": "cpp",
23+
"clocale": "cpp",
24+
"cmath": "cpp",
25+
"compare": "cpp",
26+
"complex": "cpp",
27+
"concepts": "cpp",
28+
"cstdarg": "cpp",
29+
"cstddef": "cpp",
30+
"cstdint": "cpp",
31+
"cstdio": "cpp",
32+
"cstdlib": "cpp",
33+
"cstring": "cpp",
34+
"ctime": "cpp",
35+
"cwchar": "cpp",
36+
"cwctype": "cpp",
37+
"exception": "cpp",
38+
"initializer_list": "cpp",
39+
"ios": "cpp",
40+
"iosfwd": "cpp",
41+
"iostream": "cpp",
42+
"istream": "cpp",
43+
"limits": "cpp",
44+
"locale": "cpp",
45+
"memory": "cpp",
46+
"mutex": "cpp",
47+
"new": "cpp",
48+
"optional": "cpp",
49+
"ostream": "cpp",
50+
"ratio": "cpp",
51+
"sstream": "cpp",
52+
"stdexcept": "cpp",
53+
"streambuf": "cpp",
54+
"string": "cpp",
55+
"string_view": "cpp",
56+
"system_error": "cpp",
57+
"tuple": "cpp",
58+
"type_traits": "cpp",
59+
"typeinfo": "cpp",
60+
"unordered_map": "cpp",
61+
"variant": "cpp",
62+
"vector": "cpp",
63+
"__functional_base": "cpp",
64+
"algorithm": "cpp",
65+
"functional": "cpp",
66+
"iterator": "cpp",
67+
"utility": "cpp"
68+
}
69+
}

cpp_calculator/.vscode/tasks.json

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"tasks": [
3+
{
4+
"type": "cppbuild",
5+
"label": "C/C++: clang++ build active file",
6+
"command": "/usr/bin/clang++",
7+
"args": [
8+
"-std=c++17",
9+
"-fcolor-diagnostics",
10+
"-fansi-escape-codes",
11+
"-g",
12+
"${file}",
13+
"-o",
14+
"${fileDirname}/${fileBasenameNoExtension}"
15+
],
16+
"options": {
17+
"cwd": "${fileDirname}"
18+
},
19+
"problemMatcher": [
20+
"$gcc"
21+
],
22+
"group": {
23+
"kind": "build",
24+
"isDefault": true
25+
},
26+
"detail": "Task generated by Debugger."
27+
}
28+
],
29+
"version": "2.0.0"
30+
}

cpp_calculator/README.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# About
2+
3+
Nowadays carrying around calculators isn't feasible. When you need to calculate something important in a hurry, use this app!
4+
5+
# Technologies
6+
7+
Front-End - React/NextJs
8+
Back-End - C++ Sever - Restbed Framework
9+

cpp_calculator/calculator.cpp

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#include <iostream>
2+
#include <string>
3+
using namespace std;
4+
#include "calculator.h"
5+
#include <cmath>
6+
#include <iomanip>
7+
8+
int calculateAnswer(string operation, double first_num, double second_num)
9+
{
10+
int answer{};
11+
if (operation == "+" )
12+
{
13+
answer = first_num + second_num;
14+
}
15+
else if (operation == "-" )
16+
{
17+
answer = first_num - second_num;
18+
}
19+
else if (operation == "*" )
20+
{
21+
answer = first_num * second_num;
22+
}
23+
else if (operation == "/" )
24+
{
25+
answer = floor(first_num / second_num);
26+
}
27+
return answer;
28+
}
29+
30+
// gets numeric value from user and returns to main
31+
int getNumValue()
32+
{
33+
double userInput {};
34+
std::cout << "Please enter a number" << "\n";
35+
std::cin >> userInput;
36+
return userInput;
37+
}
38+
39+
int main()
40+
{
41+
// Assign first number from input
42+
double first_num {};
43+
first_num = getNumValue();
44+
45+
// Assign operator number from input
46+
string operation = "";
47+
std::cout << "What would you like to do with it? \n";
48+
std::cin >> operation;
49+
50+
// Assign second number from input
51+
double second_num {};
52+
second_num = getNumValue();
53+
54+
// Calculate and pring answer
55+
std::cout << setprecision(13);
56+
double answer = calculateAnswer(operation, first_num, second_num);
57+
std::cout << answer;
58+
59+
// catch if user puts in letter instead of number
60+
if (!std::cin.good())
61+
{
62+
throw std::invalid_argument( "Why did you put in a letter?" );
63+
}
64+
return 0;
65+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>English</string>
7+
<key>CFBundleIdentifier</key>
8+
<string>com.apple.xcode.dsym.calculator</string>
9+
<key>CFBundleInfoDictionaryVersion</key>
10+
<string>6.0</string>
11+
<key>CFBundlePackageType</key>
12+
<string>dSYM</string>
13+
<key>CFBundleSignature</key>
14+
<string>????</string>
15+
<key>CFBundleShortVersionString</key>
16+
<string>1.0</string>
17+
<key>CFBundleVersion</key>
18+
<string>1</string>
19+
</dict>
20+
</plist>
Binary file not shown.

is_even/.vscode/settings.json

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
{
2+
"files.associations": {
3+
"__bit_reference": "cpp",
4+
"__bits": "cpp",
5+
"__config": "cpp",
6+
"__debug": "cpp",
7+
"__errc": "cpp",
8+
"__hash_table": "cpp",
9+
"__locale": "cpp",
10+
"__mutex_base": "cpp",
11+
"__node_handle": "cpp",
12+
"__nullptr": "cpp",
13+
"__split_buffer": "cpp",
14+
"__string": "cpp",
15+
"__threading_support": "cpp",
16+
"__tuple": "cpp",
17+
"array": "cpp",
18+
"atomic": "cpp",
19+
"bit": "cpp",
20+
"bitset": "cpp",
21+
"cctype": "cpp",
22+
"chrono": "cpp",
23+
"clocale": "cpp",
24+
"cmath": "cpp",
25+
"compare": "cpp",
26+
"complex": "cpp",
27+
"concepts": "cpp",
28+
"cstdarg": "cpp",
29+
"cstddef": "cpp",
30+
"cstdint": "cpp",
31+
"cstdio": "cpp",
32+
"cstdlib": "cpp",
33+
"cstring": "cpp",
34+
"ctime": "cpp",
35+
"cwchar": "cpp",
36+
"cwctype": "cpp",
37+
"exception": "cpp",
38+
"initializer_list": "cpp",
39+
"ios": "cpp",
40+
"iosfwd": "cpp",
41+
"iostream": "cpp",
42+
"istream": "cpp",
43+
"limits": "cpp",
44+
"locale": "cpp",
45+
"memory": "cpp",
46+
"mutex": "cpp",
47+
"new": "cpp",
48+
"optional": "cpp",
49+
"ostream": "cpp",
50+
"ratio": "cpp",
51+
"sstream": "cpp",
52+
"stdexcept": "cpp",
53+
"streambuf": "cpp",
54+
"string": "cpp",
55+
"string_view": "cpp",
56+
"system_error": "cpp",
57+
"tuple": "cpp",
58+
"type_traits": "cpp",
59+
"typeinfo": "cpp",
60+
"unordered_map": "cpp",
61+
"variant": "cpp",
62+
"vector": "cpp",
63+
"__functional_base": "cpp",
64+
"algorithm": "cpp",
65+
"functional": "cpp",
66+
"iterator": "cpp",
67+
"utility": "cpp"
68+
}
69+
}

is_even/.vscode/tasks.json

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"tasks": [
3+
{
4+
"type": "cppbuild",
5+
"label": "C/C++: clang++ build active file",
6+
"command": "/usr/bin/clang++",
7+
"args": [
8+
"-std=c++17",
9+
"-fcolor-diagnostics",
10+
"-fansi-escape-codes",
11+
"-g",
12+
"${file}",
13+
"-o",
14+
"${fileDirname}/${fileBasenameNoExtension}"
15+
],
16+
"options": {
17+
"cwd": "${fileDirname}"
18+
},
19+
"problemMatcher": [
20+
"$gcc"
21+
],
22+
"group": {
23+
"kind": "build",
24+
"isDefault": true
25+
},
26+
"detail": "Task generated by Debugger."
27+
}
28+
],
29+
"version": "2.0.0"
30+
}

is_even/README.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# About
2+
3+
Nowadays carrying around calculators isn't feasible. When you need to calculate something important in a hurry, use this app!
4+
5+
# Technologies
6+
7+
Front-End - React/NextJs
8+
Back-End - C++ Sever - Restbed Framework
9+

is_even/isEven

62.1 KB
Binary file not shown.

is_even/isEven.cpp

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#include <iostream>
2+
#include <string>
3+
using namespace std;
4+
5+
void checkIsEven(int numInput)
6+
{
7+
if (numInput % 2 == 0){
8+
std::cout << numInput << " is even!" << "\n";
9+
} else {
10+
std::cout << "Sorry, " << numInput << " is not even" << "\n";
11+
}
12+
}
13+
14+
int getNumberInput()
15+
{
16+
int numInput {};
17+
std::cout << "Please enter a number" << "\n";
18+
std::cin >> numInput;
19+
return numInput;
20+
}
21+
22+
int main()
23+
{
24+
int numInput {};
25+
numInput = getNumberInput();
26+
checkIsEven(numInput);
27+
28+
// catch if user puts in letter instead of number
29+
if (!std::cin.good())
30+
{
31+
throw std::invalid_argument( "Why did you put in a letter?" );
32+
}
33+
return 0;
34+
}

0 commit comments

Comments
 (0)