@op follow me and i can send it in messages if not
Preciate u my brada I followed u
OP gotta pay a bag to get this s*** done. Thought it be some simple Hello World s*** but nah this requires some more work
Uni profs are f***in krazy we in a middle of a panoramic and they stay giving us these type assignments
Uni profs are f***in krazy we in a middle of a panoramic and they stay giving us these type assignments
Panoramic
Out of the endless resources on the internet you choose the KTT 2 music section to try and get help
ok here's the linked list stuff
you just need to change the name of the List class to macth your question
pastebin.com/6iaMmD7x
#include //delete space between io stream
#include <assert.h>
class Node {
public:
int item;
//set node to nullptr or it will be free memory cdcdcdd
Node* next = nullptr;
};
class List {
private:
Node* first = nullptr;
public:
void addFront(int i)
{
if (isEmpty())
{
first = new Node;
first->item = i;
}
else {
Node *n = new Node;
n->next = first;
first = n;
first->item = i;
}
}
bool isEmpty()
{
return first == nullptr;
}
int size()
{
if (isEmpty())
{
return 0;
}
else
{
int counter = 1;
Node *n = first;
while (n->next != nullptr)
{
counter++;
n = n->next;
}
return counter;
}
}
void removeFront()
{
if (!isEmpty())
{
Node *n = first;
first = first->next;
delete n;
}
}
void clear()
{
while (!isEmpty())
{
Node *n = first;
first = first->next;
delete n;
}
}
~List() { clear(); }
bool contains(int i)
{
if (isEmpty())
{
return false;
}
else
{
bool cont = false;
Node *n = first;
while (n->next != nullptr || cont != true)
{
if (n->item == i)
{
cont = true;
}
n = n->next;
}
return cont;
}
}
int getAt(int pos)
{
assert(pos >= 0);
assert(pos < size());
int counter = 0;
Node *n = first;
while (counter <= pos)
{
if (counter == pos)
{
return n->item;
}
counter++;
n = n->next;
}
assert(false); // should never get here
return -999999999;
}
};
int main()
{
//List numbers;
//std::cout << numbers.size();
//std::cout << numbers.isEmpty();
//numbers.addFront(3);
//std::cout << numbers.size();
//std::cout << numbers.isEmpty();
//numbers.addFront(2);
//numbers.addFront(1);
//std::cout << numbers.size();
//numbers.removeFront();
//std::cout << numbers.size();
//numbers.clear();
//std::cout << numbers.size();
//numbers.addFront(2);
//numbers.addFront(3);
//numbers.addFront(2);
//std::cout << "\n\n\n";
//std::cout << numbers.contains(3);
List numbers;
numbers.addFront(3);
numbers.addFront(2);
numbers.addFront(1);
for (int i = 0; i < numbers.size(); i++)
{
std::cout << numbers.getAt(i) << ' ';
}
system("pause");
return 0;
}
Take a look y'all
@op
ok here's the linked list stuff
you just need to change the name of the List class to macth your question
https://pastebin.com/6iaMmD7x
Much love bro shout outs to you
oooo its gonna f*** up cos of ktt formatting
@op can hit View Source with the … by your post & see the actual text
@op can hit View Source with the … by your post & see the actual text
when i saw the notification i thought you were gonna tell me i cant be posting his hw and that im muted
when i saw the notification i thought you were gonna tell me i cant be posting his hw and that im muted
man thank god i'm over with C++
RT lol other languages so much nicer to use