Skip to content

Commit 4b74dc8

Browse files
committed
cpp practice
0 parents  commit 4b74dc8

File tree

5 files changed

+100
-0
lines changed

5 files changed

+100
-0
lines changed

Diff for: .vscode/c_cpp_properties.json

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"configurations": [
3+
{
4+
"name": "macos-gcc-x64",
5+
"includePath": [
6+
"${workspaceFolder}/**"
7+
],
8+
"compilerPath": "/usr/bin/clang",
9+
"cStandard": "${default}",
10+
"cppStandard": "${default}",
11+
"intelliSenseMode": "macos-gcc-x64",
12+
"compilerArgs": [
13+
"-Wall",
14+
"-Wextra",
15+
"-Wpedantic"
16+
]
17+
}
18+
],
19+
"version": 4
20+
}

Diff for: .vscode/launch.json

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "C/C++ Runner: Debug Session",
6+
"type": "cppdbg",
7+
"request": "launch",
8+
"args": [],
9+
"stopAtEntry": false,
10+
"cwd": "/Users/manucheremeh/Documents/cpp_practice",
11+
"environment": [],
12+
"program": "/Users/manucheremeh/Documents/cpp_practice/build/Debug/outDebug",
13+
"internalConsoleOptions": "openOnSessionStart",
14+
"MIMode": "lldb",
15+
"miDebuggerPath": "/usr/bin/lldb",
16+
"externalConsole": false,
17+
"setupCommands": [
18+
{
19+
"description": "Enable pretty-printing for gdb",
20+
"text": "-enable-pretty-printing",
21+
"ignoreFailures": true
22+
}
23+
]
24+
}
25+
]
26+
}

Diff for: .vscode/settings.json

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"C_Cpp_Runner.cCompilerPath": "/usr/bin/clang",
3+
"C_Cpp_Runner.cppCompilerPath": "/usr/bin/clang++",
4+
"C_Cpp_Runner.debuggerPath": "/usr/bin/lldb",
5+
"C_Cpp_Runner.makePath": "/usr/bin/make",
6+
"C_Cpp_Runner.warnings": [
7+
"-Wall",
8+
"-Wextra",
9+
"-Wpedantic"
10+
],
11+
"C_Cpp_Runner.compilerArgs": [],
12+
"C_Cpp_Runner.includePaths": [],
13+
"C_Cpp_Runner.linkerArgs": [],
14+
"C_Cpp_Runner.cStandard": "",
15+
"C_Cpp_Runner.cppStandard": "",
16+
"C_Cpp_Runner.excludeSearch": [],
17+
"C_Cpp_Runner.enableWarnings": true,
18+
"C_Cpp_Runner.warningsAsError": false
19+
}

Diff for: initial_abbrev_2letter_name.cpp

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//My first solution
2+
include <cctype>
3+
4+
std::string abbrevName(std::string name)
5+
{
6+
std::string abrev;
7+
for (unsigned int x = 0; x < name.length(); x++) {
8+
if (x == 0 || name[x - 1] == ' ') {
9+
abrev += toupper(name[x]);
10+
abrev += ".";
11+
}
12+
}
13+
abrev.pop_back();
14+
return abrev;
15+
}
16+
17+
//Best refactored solution
18+
std::string abbrevName(std::string name)
19+
{
20+
return std::string({ (char)toupper(name[0]), '.', (char)toupper(name[name.find(' ')+1]) });
21+
}

Diff for: pointers.cpp

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
int main(int argc, char const *argv[])
2+
{
3+
int * point;
4+
bool pointed = 3;
5+
point = &pointed;
6+
7+
struc Person
8+
{
9+
char fullname[30];
10+
date DOB;
11+
}
12+
13+
return 0;
14+
}

0 commit comments

Comments
 (0)