changed structure
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
cmake_minimum_required(VERSION 3.24)
|
||||
project(cppout)
|
||||
|
||||
file(GLOB SOURCE_FILES "*.cpp")
|
||||
|
||||
add_executable(${PROJECT_NAME} ${SOURCE_FILES})
|
||||
@@ -0,0 +1,4 @@
|
||||
#include <cstdio>
|
||||
void printhello(const char *name) {
|
||||
printf("hello %s \n", name);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
void printhello(const char *name);
|
||||
@@ -0,0 +1,7 @@
|
||||
#include <cstdlib>
|
||||
#include "hello.h"
|
||||
int main() {
|
||||
printhello("test");
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
Executable
BIN
Binary file not shown.
@@ -0,0 +1,6 @@
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
std::cout << "Hello, world";
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
cmake_minimum_required(VERSION 3.24)
|
||||
project(cppout)
|
||||
|
||||
file(GLOB SOURCE_FILES "*.cpp")
|
||||
|
||||
add_executable(${PROJECT_NAME} ${SOURCE_FILES})
|
||||
@@ -0,0 +1,47 @@
|
||||
#include <cstddef>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <vector>
|
||||
|
||||
void bsort(std::vector<int> &input_vec){
|
||||
/*
|
||||
voor elk nummer i in k behalve de laatste
|
||||
ga langs elk volgende nummer j behalve de laatste
|
||||
en kijk of i+1 groter is dan i, als i groter is dan j, verplaats i naar
|
||||
j
|
||||
*/
|
||||
|
||||
for (size_t i = 0; i < input_vec.size(); i++) {
|
||||
printf("%zu\n", i);
|
||||
for (size_t j = 0; j < input_vec.size()-1-i; j++) {
|
||||
if (input_vec[j]>input_vec[j+1]) {
|
||||
int temp = input_vec[j + 1];
|
||||
input_vec[j + 1] = input_vec[j];
|
||||
input_vec[j] = temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// returns an array of length filled with random positive integers of up to max
|
||||
std::vector<int> createranarr(size_t input_length, size_t max){
|
||||
std::vector<int> myv;
|
||||
for (size_t i = 0; i < input_length; i++) {
|
||||
myv.push_back(rand() % max);
|
||||
}
|
||||
return myv;
|
||||
}
|
||||
|
||||
void arrprinter(const std::vector<int> &input_vec) {
|
||||
for (size_t i = 0; i < input_vec.size(); i++) {
|
||||
std::printf("number:%zu = %d\n",i, input_vec[i]);
|
||||
}
|
||||
}
|
||||
|
||||
int main() {
|
||||
std::vector<int> myvector = createranarr(10, 100);
|
||||
arrprinter(myvector);
|
||||
bsort(myvector);
|
||||
arrprinter(myvector);
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
cmake_minimum_required(VERSION 3.24)
|
||||
project(cppout)
|
||||
|
||||
file(GLOB SOURCE_FILES "*.cpp")
|
||||
|
||||
find_package(Curses REQUIRED)
|
||||
include_directories(${CURSES_INCLUDE_DIR})
|
||||
|
||||
add_executable(${PROJECT_NAME} ${SOURCE_FILES})
|
||||
target_link_libraries(${PROJECT_NAME} ${CURSES_LIBRARIES})
|
||||
@@ -0,0 +1,12 @@
|
||||
#include <ncurses.h>
|
||||
|
||||
int main() {
|
||||
initscr();
|
||||
move(11, 26);
|
||||
printw("Hello curses");
|
||||
refresh();
|
||||
getch();
|
||||
endwin();
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user