Skip to content

Commit

Permalink
Added a little color eye candy. And fixed qdel bug
Browse files Browse the repository at this point in the history
  • Loading branch information
adiultra committed May 30, 2016
1 parent 76ca298 commit 5a8f661
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 19 deletions.
2 changes: 2 additions & 0 deletions color.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const char red[12] = "\033[1;31m";
const char normal[12] = "\033[0;m";
Binary file modified data.tdx
Binary file not shown.
26 changes: 19 additions & 7 deletions fabric.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@

using namespace std;

// Color variables

const char Bred[12] = "\033[1;31m";
const char Bgreen[12] = "\033[1;32m";
const char Byellow[12] = "\033[1;33m";
const char Bblue[12] = "\033[1;34m";
const char Bmagenta[12] = "\033[1;35m";
const char Bcyan[12] = "\033[1;36m";

const char normal[12] = "\033[0;m";

class Todo{
public:
char content[200];
Expand Down Expand Up @@ -67,24 +78,25 @@ List::List(char Title[100]) {
}

void List::enter(){
cout << "Enter title for your list\n +> ";
cout << "Enter title for your list" << endl << Bgreen << " +> " << normal;
cin.getline(title, sizeof(title));

char choice[10];
cout << "Do you want some tags? (yes/no)" << endl << " ?> ";
cout << "Do you want some tags? (yes/no)" << endl << Bred << " ?> " << normal;
cin.getline(choice, sizeof(choice));

if (!(strcmp(choice, "yes")*strcmp(choice, "y"))) {
char tagTemp[220];

cout << "Enter the tag one at a time \n 'd' when done \n +> ";
cout << "Enter the tag one at a time" << endl << "\'d\' when done " << endl;
cout << Bgreen << " +> " << normal;

while (1) {
cin.getline(tagTemp, 20);

if (strcmp(tagTemp, "d") != 0) {
addTag(tagTemp);
cout << " +> ";
cout << Bgreen << " +> " << normal;
}

else {
Expand Down Expand Up @@ -147,7 +159,7 @@ void List::todoView(int index) {

void List::append(){
char Content[200];
cout << "Enter the content of ToDo \n +> ";
cout << "Enter the content of ToDo" << endl << Bgreen << " +> " << normal;
cin.getline(Content, 200);

strcpy(list[_listIndex].content, Content);
Expand All @@ -158,8 +170,8 @@ void List::append(){
}

void List::remove(int index) {
for (int i = index; i < _listIndex - 1; i++) {
list[index] = list[index + 1];
for (int i = index; i < _listIndex; i++) {
list[i] = list[i + 1];
}
_listIndex--;
}
Expand Down
25 changes: 13 additions & 12 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

using namespace std;


// Variables used throughout the program

List arrayL[20];
Expand Down Expand Up @@ -73,13 +74,13 @@ int parse(char command[80]){

displayL();

cout << " #> ";
cout << Bblue << " #> " << normal;
cin >> choice;
cin.ignore();

while ( !(0 <= choice && choice < _arrayLindex) ) {
cout << "Invalid choice choose again" << endl;
cout << " #> ";
cout << Bblue << " #> " << normal;
cin >> choice;
cin.ignore();
}
Expand Down Expand Up @@ -112,17 +113,17 @@ int parse(char command[80]){
int choice;
currentL.indexView();

cout << "Choose the Todo to mark : " << endl << " #> ";
cout << "Choose the Todo to mark : " << endl << Bblue << " #> " << normal;
cin >> choice;

while (choice >= currentL._listIndex || choice < 0) {
cout << "Invalid Choice Try again" << endl << " #>";
cout << "Invalid Choice Try again" << endl << Bblue << " #> " << normal;
cin >> choice;
}

char status;

cout << "Enter The new Status" << endl << " +> ";
cout << "Enter The new Status" << endl << Bgreen << " +> " << normal;
cin >> status;
cin.ignore();

Expand Down Expand Up @@ -166,7 +167,7 @@ int parse(char command[80]){
// Search the Database
char term[40];

cout << "Enter the search term " << endl << " +> ";
cout << "Enter the search term " << endl << Bgreen << " +> " << normal;
cin.getline(term, sizeof(term));
search(term, arrayL);
success = 1;
Expand All @@ -183,7 +184,7 @@ int parse(char command[80]){
// Delete Things

char choice[10];
cout << "What do you want to delete? (list/todo)" << endl << " ?> ";
cout << "What do you want to delete? (list/todo)" << endl << Bred << " ?> " << normal;
cin.getline(choice, sizeof(choice));

if (!(strcmp(choice, "list") * strcmp(choice, "List"))) {
Expand All @@ -192,7 +193,7 @@ int parse(char command[80]){
cout << "Enter the Index of List to Delete " << endl;
displayL();

cout << " #> ";
cout << Bblue << " #> " << normal;
cin >> index;
cin.ignore();
cout << "Are you sure, This cannot be undone, This will delete ->" << endl;
Expand All @@ -214,7 +215,7 @@ int parse(char command[80]){
cout << "Enter the Index of Todo to Delete " << endl;
currentL.indexView();

cout << " #> ";
cout << Bblue << " #> " << normal;
cin >> index;
cin.ignore();
cout << "Are you sure, This cannot be undone, This will delete ->" << endl;
Expand Down Expand Up @@ -246,7 +247,7 @@ int parse(char command[80]){
cout << "Enter the Index of List to Delete " << endl;
currentL.indexView();

cout << " #> ";
cout << Bblue << " #> " << normal;
cin >> index;
cin.ignore();
cout << "Are you sure, This cannot be undone, This will delete ->" << endl;
Expand Down Expand Up @@ -339,7 +340,7 @@ void displayL() {
int confirm() {
// can be used as if( confirm() ) /// Improves yes/no prompts
char confm[10];
cout << "Enter \'yes\' to continue" << endl << " ?> ";
cout << "Enter \'yes\' to continue" << endl << Bred << " ?> " << normal;
cin.getline(confm, 10);

if (!(strcmp(confm, "yes") * strcmp(confm, "y"))) {
Expand Down Expand Up @@ -376,7 +377,7 @@ int main() {
char command[80];

while (1) {
cout << "\n *> ";
cout << Byellow << "\n *> " << normal;
cin.getline(command, 80);
int result = parse(command);

Expand Down

0 comments on commit 5a8f661

Please sign in to comment.