Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // Lista.cpp
- // ProjetoDicionario
- //
- // Created by Rafael Prado on 26/05/17.
- // Copyright © 2017 Rafael Prado. All rights reserved.
- //
- #include<iostream>
- #include<iomanip>
- #include <stdlib.h>
- #include "Lista.h"
- using namespace std;
- //=====================================Cadastrar================================
- void Cadastrar (noptr &lista)
- {
- noptr p;
- p = new No;
- cout << "Digite a palavra em portugues:" << endl;
- cin.ignore();
- cin >> p->Ptbr;
- cout << "Enter the word in English:" << endl;
- cin.ignore();
- cin >> p->Eng;
- if(lista == NULL)
- p->next = NULL;
- else
- p->next = lista;
- lista = p;
- }
- //======================================Listar====================================
- void Listar (noptr &lista)
- {
- int p;
- if (lista == NULL)
- {
- cout << endl;
- cout << "Fim da lista\n";
- cout << endl;
- }
- else
- {
- cout << endl;
- cout << "Palavra em portugues: ";
- p = 0;
- while(lista->Ptbr[p] != '\0')
- {
- cout << lista->Ptbr[p];
- p++;
- }
- cout << endl;
- p = 0;
- cout << "Word in english: ";
- while(lista->Eng[p] != '\0')
- {
- cout << lista->Eng[p];
- p++;
- }
- cout << endl;
- Listar(lista->next);
- cout << endl;
- }
- }
- //=======================================Buscar==================================
- void Buscar (noptr &lista, char vetbuscar[])
- {
- int i=0, j=0;
- No *p = lista;
- while(vetbuscar[j] != '\0')
- {
- j++;
- }
- if(p == NULL)
- cout << "Essa palavra nao faz parte da lista" << endl;
- else
- {
- while(vetbuscar[i] != '\0')
- {
- if((vetbuscar[i]) == (p->Ptbr[i]) || (vetbuscar[i]) == (p->Eng[i]))
- i++;
- else
- Buscar(p->next, vetbuscar);
- }
- }
- if(i==j)
- cout << "A palavra faz parte da lista" << endl;
- }
- //===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement