idk
This commit is contained in:
parent
d1ba83064a
commit
49166965ff
7
Makefile
7
Makefile
@ -1,4 +1,4 @@
|
|||||||
CC := clang++ -Wall -std=c++17 -Wall -Wextra -O1 -g -fsanitize=address,undefined -fno-omit-frame-pointer
|
CC := clang++ -Wall -std=c++17 -Wall -Wextra -g -fsanitize=address,undefined -fno-omit-frame-pointer
|
||||||
|
|
||||||
setup:
|
setup:
|
||||||
mkdir build
|
mkdir build
|
||||||
@ -34,6 +34,11 @@ sheet05:
|
|||||||
chmod +x build/sheet05
|
chmod +x build/sheet05
|
||||||
build/sheet05
|
build/sheet05
|
||||||
|
|
||||||
|
sheet06:
|
||||||
|
$(CC) src/sheet06.cpp -o build/sheet06
|
||||||
|
chmod +x build/sheet06
|
||||||
|
build/sheet06
|
||||||
|
|
||||||
pizza:
|
pizza:
|
||||||
$(CC) src/pizza.cpp -o build/pizza
|
$(CC) src/pizza.cpp -o build/pizza
|
||||||
chmod +x build/pizza
|
chmod +x build/pizza
|
||||||
|
@ -211,7 +211,7 @@ class vec
|
|||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
std::string ans;
|
std::string ans;
|
||||||
std::cout << "y for vector exercies: ";
|
std::cout << "y for vector exercises: ";
|
||||||
std::cin >> ans;
|
std::cin >> ans;
|
||||||
if(ans == "y")
|
if(ans == "y")
|
||||||
{
|
{
|
||||||
|
@ -126,25 +126,19 @@ struct Node {
|
|||||||
|
|
||||||
void addElement(Node **head, int data)
|
void addElement(Node **head, int data)
|
||||||
{
|
{
|
||||||
if(*head == nullptr)
|
Node **og_head = head;
|
||||||
{
|
|
||||||
*head = new Node(data);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Node **next = &(**head).next;
|
while(*head != nullptr)
|
||||||
do
|
|
||||||
{
|
{
|
||||||
*next = (**next).next;
|
head = &(**head).next;
|
||||||
}
|
}
|
||||||
while(*next != nullptr)
|
*head = new Node(data);
|
||||||
*next = new Node(data);
|
head = og_head;
|
||||||
}
|
}
|
||||||
void printList(const Node *head)
|
void printList(const Node *head)
|
||||||
{
|
{
|
||||||
std::cout << *head << '\n';
|
std::cout << *head << '\n';
|
||||||
Node *next = (*head).next;
|
Node *next = (*head).next;
|
||||||
std::cout << (next != nullptr) << '\n';
|
|
||||||
while(next != nullptr)
|
while(next != nullptr)
|
||||||
{
|
{
|
||||||
std::cout << *next << '\n';
|
std::cout << *next << '\n';
|
||||||
|
10
src/sheet06.cpp
Normal file
10
src/sheet06.cpp
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#include<iostream>
|
||||||
|
#define MY_ASSERT(BOOL_EXPR, MESSAGE)
|
||||||
|
{
|
||||||
|
if (!BOOL_EXPR)
|
||||||
|
{
|
||||||
|
std::cout << MESSAGE << '\n';
|
||||||
|
std::cout << __FILE__ << '\n';
|
||||||
|
std::cout << __LINE__ << '\n'
|
||||||
|
}
|
||||||
|
}
|
BIN
vgcore.13380
Normal file
BIN
vgcore.13380
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user