├── cpp ├── class_exercises │ ├── pizza │ ├── Class_Exercise.pdf │ └── pizza_counting_bot.cpp └── edx_intro_course │ ├── module_2_data_types │ ├── test │ ├── complex_data_types │ └── complex_data_types.cpp │ └── course_screenshots │ ├── module_2 │ ├── enum_1.png │ ├── enum_2.png │ ├── init_string.png │ ├── new_datatype_unions_1.png │ ├── new_datatype_unions_2.png │ ├── init_structure_data_type.png │ └── initialize_c_style_string.png │ ├── module_1 │ └── compiler_process.png │ └── module_3 │ ├── inline_functions_1.png │ ├── inline_functions_2.png │ └── inline_functions_3.png ├── .vscode ├── settings.json ├── tasks.json └── launch.json └── README.md /cpp/class_exercises/pizza: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kvnptl/foundation_course_practice/main/cpp/class_exercises/pizza -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.associations": { 3 | "ratio": "cpp", 4 | "random": "cpp" 5 | } 6 | } -------------------------------------------------------------------------------- /cpp/class_exercises/Class_Exercise.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kvnptl/foundation_course_practice/main/cpp/class_exercises/Class_Exercise.pdf -------------------------------------------------------------------------------- /cpp/edx_intro_course/module_2_data_types/test: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kvnptl/foundation_course_practice/main/cpp/edx_intro_course/module_2_data_types/test -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # foundation_course_practice 2 | This is a Foundation course practice repository where I'll upload all the practice execises and codes. Mainly for personal use only. 3 | -------------------------------------------------------------------------------- /cpp/edx_intro_course/course_screenshots/module_2/enum_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kvnptl/foundation_course_practice/main/cpp/edx_intro_course/course_screenshots/module_2/enum_1.png -------------------------------------------------------------------------------- /cpp/edx_intro_course/course_screenshots/module_2/enum_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kvnptl/foundation_course_practice/main/cpp/edx_intro_course/course_screenshots/module_2/enum_2.png -------------------------------------------------------------------------------- /cpp/edx_intro_course/module_2_data_types/complex_data_types: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kvnptl/foundation_course_practice/main/cpp/edx_intro_course/module_2_data_types/complex_data_types -------------------------------------------------------------------------------- /cpp/edx_intro_course/course_screenshots/module_2/init_string.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kvnptl/foundation_course_practice/main/cpp/edx_intro_course/course_screenshots/module_2/init_string.png -------------------------------------------------------------------------------- /cpp/edx_intro_course/course_screenshots/module_1/compiler_process.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kvnptl/foundation_course_practice/main/cpp/edx_intro_course/course_screenshots/module_1/compiler_process.png -------------------------------------------------------------------------------- /cpp/edx_intro_course/course_screenshots/module_3/inline_functions_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kvnptl/foundation_course_practice/main/cpp/edx_intro_course/course_screenshots/module_3/inline_functions_1.png -------------------------------------------------------------------------------- /cpp/edx_intro_course/course_screenshots/module_3/inline_functions_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kvnptl/foundation_course_practice/main/cpp/edx_intro_course/course_screenshots/module_3/inline_functions_2.png -------------------------------------------------------------------------------- /cpp/edx_intro_course/course_screenshots/module_3/inline_functions_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kvnptl/foundation_course_practice/main/cpp/edx_intro_course/course_screenshots/module_3/inline_functions_3.png -------------------------------------------------------------------------------- /cpp/edx_intro_course/course_screenshots/module_2/new_datatype_unions_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kvnptl/foundation_course_practice/main/cpp/edx_intro_course/course_screenshots/module_2/new_datatype_unions_1.png -------------------------------------------------------------------------------- /cpp/edx_intro_course/course_screenshots/module_2/new_datatype_unions_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kvnptl/foundation_course_practice/main/cpp/edx_intro_course/course_screenshots/module_2/new_datatype_unions_2.png -------------------------------------------------------------------------------- /cpp/edx_intro_course/course_screenshots/module_2/init_structure_data_type.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kvnptl/foundation_course_practice/main/cpp/edx_intro_course/course_screenshots/module_2/init_structure_data_type.png -------------------------------------------------------------------------------- /cpp/edx_intro_course/course_screenshots/module_2/initialize_c_style_string.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kvnptl/foundation_course_practice/main/cpp/edx_intro_course/course_screenshots/module_2/initialize_c_style_string.png -------------------------------------------------------------------------------- /cpp/edx_intro_course/module_2_data_types/complex_data_types.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | int a; 5 | 6 | std::cout << "Hello world!" << std::endl; 7 | 8 | // The compiler will initialize the remaining elements to the default value for the data type the array holds. 9 | // In this case, int data type, the remaining values are initialized to 0. 10 | int int_array[10] = {1, 2, 3}; 11 | double double_ary[10] = {1.0, 2.1, 3}; 12 | } -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "tasks": [ 3 | { 4 | "type": "cppbuild", 5 | "label": "C/C++: g++-9 build active file", 6 | "command": "/usr/bin/g++-9", 7 | "args": [ 8 | "-g", 9 | "${file}", 10 | "-o", 11 | "${fileDirname}/${fileBasenameNoExtension}" 12 | ], 13 | "options": { 14 | "cwd": "${fileDirname}" 15 | }, 16 | "problemMatcher": [ 17 | "$gcc" 18 | ], 19 | "group": { 20 | "kind": "build", 21 | "isDefault": true 22 | }, 23 | "detail": "Task generated by Debugger." 24 | } 25 | ], 26 | "version": "2.0.0" 27 | } -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": "g++-9 - Build and debug active file", 9 | "type": "cppdbg", 10 | "request": "launch", 11 | "program": "${fileDirname}/${fileBasenameNoExtension}", 12 | "args": [], 13 | "stopAtEntry": false, 14 | "cwd": "${fileDirname}", 15 | "environment": [], 16 | "externalConsole": false, 17 | "MIMode": "gdb", 18 | "setupCommands": [ 19 | { 20 | "description": "Enable pretty-printing for gdb", 21 | "text": "-enable-pretty-printing", 22 | "ignoreFailures": true 23 | } 24 | ], 25 | "preLaunchTask": "C/C++: g++-9 build active file", 26 | "miDebuggerPath": "/usr/bin/gdb" 27 | } 28 | ] 29 | } -------------------------------------------------------------------------------- /cpp/class_exercises/pizza_counting_bot.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | using namespace std; 6 | 7 | void printVector(vector inpVec) 8 | { 9 | for (int i = 0; i < inpVec.size(); i++) 10 | { 11 | cout << inpVec[i] << " "; 12 | } 13 | cout << endl; 14 | } 15 | 16 | // A function to implement bubble sort 17 | void bubbleSort(vector &inpVec) 18 | { 19 | int temp; 20 | 21 | for (int i = 0; i < inpVec.size(); i++) 22 | { 23 | for (int j = i + 1; j < inpVec.size(); j++) 24 | { 25 | if (inpVec[j] < inpVec[i]) 26 | { 27 | temp = inpVec[i]; 28 | inpVec[i] = inpVec[j]; 29 | inpVec[j] = temp; 30 | } 31 | } 32 | } 33 | } 34 | 35 | int main() 36 | { 37 | 38 | int total_people{5}; 39 | vector user_ary{}; 40 | vector max_slices{}; 41 | int slices{0}; 42 | int max_index{0}; 43 | int max{0}; 44 | int min_index{0}; 45 | int min{0}; 46 | 47 | for (int i = 0; i < total_people; i++) 48 | { 49 | cout << "Enter number of slices you ate: "; 50 | cin >> slices; 51 | user_ary.push_back(slices); 52 | max_slices.push_back(i); 53 | if (i == 0) 54 | { 55 | max = user_ary[0]; 56 | min = user_ary[0]; 57 | } 58 | 59 | //ate max slices 60 | if (max < slices) 61 | { 62 | max = slices; 63 | max_index = i; 64 | } 65 | 66 | //ate least slices 67 | if (min > slices) 68 | { 69 | min = slices; 70 | min_index = i; 71 | } 72 | } 73 | 74 | // cout << "Before sorting..." << endl; 75 | // printVector(user_ary); 76 | // printVector(max_slices); 77 | 78 | bubbleSort(user_ary); 79 | std::reverse(user_ary.begin(), user_ary.end()); 80 | bubbleSort(max_slices); 81 | std::reverse(max_slices.begin(), max_slices.end()); 82 | 83 | cout << "Person with slices (descending order)..." << endl; 84 | printVector(max_slices); 85 | printVector(user_ary); 86 | 87 | cout << "Most number of Pizza slices eaten by: " << max_index << endl; 88 | cout << "Least number of Pizza slices eaten by: " << min_index << endl; 89 | } --------------------------------------------------------------------------------