Skip to content

Commit 29378f0

Browse files
committed
oop
1 parent 63e278f commit 29378f0

5 files changed

Lines changed: 55 additions & 2 deletions

File tree

.vscode/settings.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
{
22
"C_Cpp.clang_format_fallbackStyle": "",
3-
"C_Cpp.clang_format_style": "{ BasedOnStyle: LLVM, UseTab: Never, IndentWidth: 4, ColumnLimit: 0, AlignConsecutiveAssignments: true, DerivePointerAlignment: true, InsertNewlineAtEOF: true}"
3+
"C_Cpp.clang_format_style": "{ BasedOnStyle: LLVM, UseTab: Never, IndentWidth: 4, ColumnLimit: 0, AlignConsecutiveAssignments: true, DerivePointerAlignment: true, InsertNewlineAtEOF: true}",
4+
"files.associations": {
5+
"typeinfo": "cpp"
6+
}
47
}

helloWorld/helloWorld.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#include <iostream>
22

3+
using namespace std;
4+
35
int main(int argc, char const *argv[]) {
4-
std::cout << "Hello World!" << std::endl;;
6+
cout << "Hello World!" << endl;
57
return 0;
68
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#include <iostream>
2+
#include <typeinfo>
3+
4+
using namespace std;
5+
6+
template <typename T>
7+
int genericMin(T a, T b);
8+
9+
int main(int argc, char const *argv[]) {
10+
11+
cout << "int " << genericMin(1, 2) << endl;
12+
cout << "double " << genericMin(1.0, 2.0) << endl;
13+
cout << "long " << genericMin(1L, 2L) << endl;
14+
return 0;
15+
}
16+
17+
template <typename T>
18+
int genericMin(T a, T b) {
19+
return (a < b ? a : b);
20+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#include <iostream>
2+
3+
using namespace std;
4+
5+
int main(int argc, char const *argv[]) {
6+
cout << "Hello World!" << endl;
7+
return 0;
8+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#ifndef RUNTIMEEXCEPTION_H
2+
#define RUNTIMEEXCEPTION_H
3+
4+
#include <iostream>
5+
using namespace std;
6+
7+
class RuntimeException {
8+
public:
9+
RuntimeException(const string& error) {
10+
errorMessage = error;
11+
}
12+
string getMessage() const {
13+
return errorMessage;
14+
}
15+
16+
private:
17+
string errorMessage;
18+
};
19+
20+
#endif

0 commit comments

Comments
 (0)