This repository has been archived by the owner on Aug 22, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
2test.cpp
168 lines (152 loc) · 4.9 KB
/
2test.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
#include<vector>
#include<iostream>
#include<curses.h>
#include <cstring>
#include <string>
//If the string is longer than the allocated amount for the data then
//cut the string and move it to the next node
//To have the greatest amount of control possible make a class that
//contains the single char and the location of that char. That way
//it can be easily the char in that location can easily be replaced or deleted.
//Replacing/deleting chords will be hard (Maybe not since they will all be under the same
//index
/* BATTLE PLAN
Each Line will be a Linked List of single chars. There will only be 6 Linked Lists
so new lines will be an illusion. The LLs are needed to be able to access the very first
Node in the list and traverse.
*/
/*
class List{
public:
List();
~List();
bool insert(Video *video);
void print();
private:
class Node{
public:
Node(char* m_arr[1], Node *next)
{m_video = video; m_next = next;}
char *m_arr[1];
Node *m_next;
};
Node *m_head;
int size=0;
};
*/
//GOAL: Create one line of tab with LL
/*
void printTitleScreen(){
clear();
std::vector <std::string> hello;
hello = {"t", "h", "e"};
// hello = {"# # ##### # # #####\n","# # # # # # #\n","##### ##### # # # #","# # # # # # #\n","# # ##### ##### ##### ####\n#" };
for (std::vector <std::string>::const_iterator it = hello.begin(); it != hello.end(); it++)
{
std::string temp = *it;
printw ( "%s \n", temp.c_str() );
}
refresh();
,---.'| ,/ .`|
| | : ,---, ___ ,` .' :
: : | ,--, ,--.' | ,--.'|_ ,--, ; ; / ,---,
| ' : ,--.'| | | : | | :,' ,---, ,--.'| ,---, .'___,/ ,' ,---.'|
; ; ' | |, ,----._,.: : : : : ' : ,-+-. / || |, ,-+-. / | ,----._,.| : | | | :
' | |__ `--'_ / / ' /: | |,--.;__,' / ,--.'|' |`--'_ ,--.'|' | / / ' /; |.'; ; ,--.--. : : :
| | :.'|,' ,'| | : || : ' | | | | | ,"' |,' ,'| | | ,"' || : |`----' | | / \ : |,-.
' : ;' | | | | .\ .| | /' :__,'| : | | / | |' | | | | / | || | .\ . ' : ;.--. .-. || : ' |
| | ./ | | : . ; '; |' : | | | ' : |__ | | | | || | : | | | | |. ; '; | | | ' \__\/: . .| | / :
; : ; ' : |__' . . || | ' | : | | '.'|| | | |/ ' : |__ | | | |/ ' . . | ' : | ," .--.; |' : |: |
| ,/ | | '.'|`---`-'| || : :_:,' ; : ;| | |--' | | '.'|| | |--' `---`-'| | ; |.' / / ,. || | '/ :
'---' ; : ;.'__/\_: || | ,' | , / | |/ ; : ;| |/ .'__/\_: | '---' ; : .' \ : |
| , / | : :`--'' ---`-' '---' | , / '---' | : : | , .-./ \ /
---`-' \ \ / ---`-' \ \ / `--`---' `-'----'
`--`-' `--`-'
}
*/
class List{
public:
List();
~List();
void insert(char c);
void print();
private:
class Node{
public:
Node(char c, Node *next)
{m_c = c; m_next = next;}
char m_c;
Node *m_next;
};
Node *m_head;
};
List::List(){
m_head = NULL;
this->insert('|');
}
void List::insert(char c)
{
Node *ptr =m_head;
if(m_head==NULL){
m_head = new Node(c, NULL);
//printw("%s\n", &(m_head->m_c));
}
else{
while(ptr->m_next != NULL){
ptr = ptr->m_next;
}
ptr->m_next = new Node(c, NULL);
//printw("%s\n", &(ptr->m_next->m_c));
}
// printw( "XXX: %c\n", ptr->m_c );
}
//Could cause issues
List::~List()
{
Node *ptr = m_head;
while(ptr != NULL)
{
Node *temp;
temp = ptr;
ptr = ptr->m_next;
delete temp;
}
}
void List::print()
{
Node *ptr = m_head;
while(ptr!=NULL)
{
printw( "%s ", &(ptr->m_c) );
ptr =ptr->m_next;
}
printw( "\n");
//delete ptr;
}
int main()
{
initscr();
(void)echo();
char test[100];
List listE;
List liste;
for(int i=0;i<100;i++){
test[i] = '$';
}
addstr( "> " );
getnstr(test, sizeof( test ) -1);
while(true){
clear();
refresh();
liste.insert(test[0]);
liste.print();
listE.insert(test[1]);
listE.print();
//printw( "%s\n", test);
refresh();
addstr( "test> " );
getnstr(test, sizeof( test ) -1);
}
endwin();
return 0;
}