Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for CMake and CLion to execute files #36

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
.vscode/
.idea
*.out
*.o
*.o
/cmake-build-debug/
bin
15 changes: 15 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
cmake_minimum_required(VERSION 3.0)

project(Object-Oriented-Programming-C++)

enable_language(C)

set(CMAKE_BINARY_DIR ${CMAKE_SOURCE_DIR}/bin)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR})

add_subdirectory(IntroToOOP)
add_subdirectory(pointersInC)
add_subdirectory(reviseC)
add_subdirectory(Search)
add_subdirectory(Sort)
add_subdirectory(Structures)
23 changes: 23 additions & 0 deletions IntroToOOP/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
cmake_minimum_required(VERSION 3.13)

add_executable(abstract abstract.cpp)
add_executable(class1 class1.cpp)
add_executable(classTemplate classTemplate.cpp)
add_executable(copy copy.cpp)
add_executable(dynAlloc dynAlloc.cpp)
add_executable(dynamicArray dynamicArray.cpp)
add_executable(dynamicObject dynamicObject.cpp)
add_executable(fc fc.cpp)
add_executable(friend friend.cpp)
add_executable(funOver funOver.cpp)
add_executable(incrementOver incrementOver.cpp)
add_executable(IntroToOOPS IntroToOOPS.cpp)
add_executable(opOver opOver.cpp)
add_executable(opOverUnary opOverUnary.cpp)
add_executable(tempAdd tempAdd.cpp)
add_executable(tryCatch tryCatch.cpp)
add_executable(vector vector.cpp)
add_executable(virtual virtual.cpp)

add_subdirectory(classTest)
add_subdirectory(inheritance)
Binary file removed IntroToOOP/a.out
Binary file not shown.
10 changes: 10 additions & 0 deletions IntroToOOP/classTest/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
cmake_minimum_required(VERSION 3.13)


add_executable(sample1 sample1.cpp)
add_executable(sample2 sample2.cpp)
add_executable(sample3 sample3.cpp)
add_executable(sample6 sample6.cpp)
add_executable(sample7 sample7.cpp)
add_executable(sample4 sample4.c)
add_executable(sample5 sample5.cpp)
Binary file removed IntroToOOP/classTest/a.out
Binary file not shown.
7 changes: 7 additions & 0 deletions IntroToOOP/inheritance/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
cmake_minimum_required(VERSION 3.13)


add_executable(hierarchical hierarchical.cpp)
add_executable(hybrid hybrid.cpp)
add_executable(multilevel multilevel.cpp)
add_executable(single single.cpp)
Binary file removed IntroToOOP/inheritance/a.out
Binary file not shown.
Binary file removed IntroToOOP/inheritance/multiple.out
Binary file not shown.
Binary file removed IntroToOOP/inheritance/single.o
Binary file not shown.
3 changes: 3 additions & 0 deletions Search/Binary_Search/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
cmake_minimum_required(VERSION 3.13)

add_executable(binary binary.c)
7 changes: 7 additions & 0 deletions Search/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
cmake_minimum_required(VERSION 3.13)

add_subdirectory(Binary_Search)
add_subdirectory(Exponential_Search)
add_subdirectory(Interpolation_Search)
add_subdirectory(Jump_Search)
add_subdirectory(Linear_Search)
2 changes: 2 additions & 0 deletions Search/Exponential_Search/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
cmake_minimum_required(VERSION 3.13)

2 changes: 2 additions & 0 deletions Search/Interpolation_Search/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
cmake_minimum_required(VERSION 3.13)

2 changes: 2 additions & 0 deletions Search/Jump_Search/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
cmake_minimum_required(VERSION 3.13)

2 changes: 2 additions & 0 deletions Search/Linear_Search/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
cmake_minimum_required(VERSION 3.13)

4 changes: 4 additions & 0 deletions Sort/Bubble_Sort/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
cmake_minimum_required(VERSION 3.13)


add_executable(bubble bubble.c)
2 changes: 2 additions & 0 deletions Sort/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
cmake_minimum_required(VERSION 3.13)

2 changes: 2 additions & 0 deletions Sort/Heap_Sort/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
cmake_minimum_required(VERSION 3.13)

4 changes: 4 additions & 0 deletions Sort/Insertion_Sort/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
cmake_minimum_required(VERSION 3.13)


add_executable(InsertionSort InsertionSort.cpp)
4 changes: 4 additions & 0 deletions Sort/Merge_Sort/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
cmake_minimum_required(VERSION 3.13)


add_executable(MergeSort MergeSort.cpp)
4 changes: 4 additions & 0 deletions Sort/Quick_Sort/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
cmake_minimum_required(VERSION 3.13)


add_executable(quickSort quickSort.cpp)
2 changes: 2 additions & 0 deletions Sort/Radix_Sort/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
cmake_minimum_required(VERSION 3.13)

4 changes: 4 additions & 0 deletions Sort/Selecton_Sort/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
cmake_minimum_required(VERSION 3.13)


add_executable(Selection_Sort Selection_Sort.c)
4 changes: 4 additions & 0 deletions Sort/Topological Sort/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
cmake_minimum_required(VERSION 3.13)


add_executable(Topological_sort Topological_sort.cpp)
7 changes: 7 additions & 0 deletions Structures/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
cmake_minimum_required(VERSION 3.0)


add_executable(nstruct nstruct.c)
add_executable(struct struct.c)
add_executable(structinfunVal structinfunVal.c)
add_executable(structinfun structinfun.c)
7 changes: 7 additions & 0 deletions pointersInC/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
cmake_minimum_required(VERSION 3.13)


add_executable(callloc callloc.c)
add_executable(pointer pointer.c)
add_executable(swapUsingPointer swapUsingPointer.c)
add_executable(PointToArray PointToArray.c)
31 changes: 31 additions & 0 deletions reviseC/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
cmake_minimum_required(VERSION 3.13)

add_subdirectory(ReviseArrays)
add_subdirectory(ReviseConditional)
add_subdirectory(ReviseLoops)
add_subdirectory(ReviseStruct)
add_subdirectory(TAT1)

add_executable(ans1 ans1.c)
add_executable(ans2 ans2.c)
add_executable(ansPrime ansPrime.c)
add_executable(armstrong armstrong.c)
add_executable(arrayAsString arrayAsString.c)
add_executable(arrayDup arrayDup.c)
add_executable(arrayip arrayip.c)
add_executable(ArrayReversal ArrayReversal.c)
add_executable(arraySum arraySum.c)
add_executable(DOB DOB.c)
add_executable(factorial factorial.c)
add_executable(fibonacci fibonacci.c)
add_executable(findsin findsin.c)
add_executable(findSumSeries findSumSeries.c)
add_executable(iptillo iptillo.c)
add_executable(palindrom palindrom.c)
add_executable(prime prime.c)
add_executable(ques004 ques4.c)
add_executable(si si.c)
add_executable(sum1l sum1l.c)
add_executable(sumDig sumDig.c)
add_executable(sumOfElements sumOfElements.c)
add_executable(vowels vowels.c)
7 changes: 7 additions & 0 deletions reviseC/ReviseArrays/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
cmake_minimum_required(VERSION 3.13)

add_executable(ques1 ques1.c)
add_executable(ques2 ques2.c)
add_executable(ques3 ques3.c)
add_executable(ques4 ques4.c)
add_executable(ques5 ques5.c)
23 changes: 12 additions & 11 deletions reviseC/ReviseArrays/ques1.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,29 @@
/* ========================================= */

#include<stdio.h>
int main () {

int main() {
// Declare the variables
int n,arr[100],i,count=0,mid[100];
int n, arr[100], i, count = 0, mid[100];
// Input the numbers
scanf("%d", &n);
for (i=0;i<n;i++) {
for (i = 0; i < n; i++) {
scanf("%d", &arr[i]);
}
// Find the elements having 'mid property'
for(i=0;i<n;i++) {
if( i == 0) {
if (arr[i+1] > arr[i]) {
for (i = 0; i < n; i++) {
if (i == 0) {
if (arr[i + 1] > arr[i]) {
mid[count] = arr[i];
count++;
}
} else if (i == n-1) {
if (arr[i-1] < arr[i]) {
}
} else if (i == n - 1) {
if (arr[i - 1] < arr[i]) {
mid[count] = arr[i];
count++;
}
} else {
if(arr[i] > arr[i-1] && arr[i] < arr[i+1]) {
if (arr[i] > arr[i - 1] && arr[i] < arr[i + 1]) {
mid[count] = arr[i];
count++;
}
Expand All @@ -33,7 +34,7 @@ int main () {
if (count == 0)
printf("No number has mid property");
else
for(i=0;i<count;i++)
for (i = 0; i < count; i++)
printf("%d\n", mid[i]);
return 0;
}
1 change: 1 addition & 0 deletions reviseC/ReviseArrays/ques3.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/* ================================================================= */

#include<stdio.h>
#include <stdlib.h>

// Function to exit the program if not equal
void notEqual(void) {
Expand Down
8 changes: 8 additions & 0 deletions reviseC/ReviseConditional/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.13)


add_executable(ques12 ques1.c)
add_executable(ques22 ques2.c)
add_executable(ques33 ques3.c)
add_executable(ques44 ques4.c)
add_executable(ques55 ques5.c)
9 changes: 9 additions & 0 deletions reviseC/ReviseLoops/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cmake_minimum_required(VERSION 3.13)


add_executable(ques111 ques1.c)
add_executable(ques222 ques2.c)
add_executable(ques333 ques3.c)
add_executable(ques444 ques4.c)
add_executable(ques555 ques5.c)
add_executable(ques666 ques6.c)
9 changes: 5 additions & 4 deletions reviseC/ReviseLoops/ques3.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
*/

#include<stdio.h>

int main() {
int n,i,j;
int n, i, j;
scanf("%d", &n);
for (i=1;i<=n;i++) {
for (j=1;j<=n-i;j++)
for (i = 1; i <= n; i++) {
for (j = 1; j <= n - i; j++)
printf(" ");
for (j=1;j<=2*i-1;j++)
for (j = 1; j <= 2 * i - 1; j++)
printf("*");
printf("\n");
}
Expand Down
8 changes: 8 additions & 0 deletions reviseC/ReviseStruct/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.13)


add_executable(ques1111 ques1.c)
add_executable(ques2222 ques2.c)
add_executable(ques3333 ques3.c)
add_executable(ques4444 ques4.c)
add_executable(ques5555 ques5.c)
Binary file removed reviseC/ReviseStruct/a.out
Binary file not shown.
8 changes: 8 additions & 0 deletions reviseC/TAT1/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.13)


add_executable(ques01 ques1.cpp)
add_executable(ques02 ques2.c)
add_executable(ques04 ques4.cpp)
add_executable(ques03 ques3.cpp)
add_executable(ques05 ques5.c)
Binary file removed reviseC/TAT1/ques4
Binary file not shown.
Binary file removed reviseC/TAT1/ques4.o
Binary file not shown.