Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <assert.h>
- #include <string.h>
- typedef struct node{
- int info;
- char * val;
- struct node* next;
- }node;
- int menu(){
- int opcao=10;
- printf("\nInserir tarefas na lista To Do\t\t\t\t (1)\n");
- printf("Mover tarefas de To do para Doing\t\t\t (2)\n");
- printf("Mover tarefas de Doing para To do\t\t\t (3)\n");
- printf("Mover tarefas de Done para To do\t\t\t (4)\n");
- printf("Mover tarefa para Done\t\t\t\t\t\t (5)\n");
- printf("Alterar utilizador de uma tarefa em Doing\t (6)\n");
- printf("Ver as tarefas atribuídas a um utilizador\t (7)\n");
- printf("Ver as tarefas por ordem de criação\t\t\t (8)\n");
- printf("Sair\t\t\t\t\t\t\t\t\t\t (0)\n\n");
- while(opcao>8 || opcao<0){
- printf("Escolha uma opção 0-8: ");
- scanf("%d",&opcao);
- }
- return opcao;
- }
- node* criar(){
- node*aux = (node*) malloc (sizeof (node));
- assert(aux);
- aux -> next = NULL;
- return aux;
- }
- void insere_inicio(node*h, char*palavra){
- node*aux = (node*) malloc(sizeof(node));
- aux -> val=palavra;
- aux -> next= h->next;
- h -> next=aux;
- }
- void print_lista(node*h){
- for(h=h->next;h;h=h->next)
- printf("%s", h->val);
- }
- void sortlist(node*h){
- node*aux = h;
- char*a;
- int trocas=0;
- do{
- trocas=0;
- h=aux->next;
- while(h->next!=NULL) {
- if (strcmp(h->val, h->next->val) > 0) {
- a = h->val;
- h->val = h->next->val;
- h->next->val = a;
- trocas++;
- }
- h = h->next;
- }
- }while(trocas>0);
- }
- int main(){
- node*todo;
- todo=criar();
- char input[128];
- printf("\tBem-vindo ao Quadro Kanban\n");
- int a=menu();fgets(input,100,stdin);
- switch(a){
- case 1:
- printf("Tarefa a inserir: ");
- fgets(input,100,stdin);strtok(input,"\n");
- insere_inicio(todo,input);
- }
- FILE *ftodo;
- ftodo = fopen("todo.txt", "w");
- fwrite(input,1,sizeof(input),ftodo);
- fclose(ftodo);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement