#include <iostream>
#include <vector>
#include <string>
#include <ctime>
using namespace std;
struct Evento {
string nome;
int dia, mes, ano, hora, minuto;
string local;
string cpf;
} ;
class CalendarioEventos {
private :
vector< Evento> eventos;
public :
// Método para adicionar evento com dados personalizados
void adicionarEvento( string nome, int dia, int mes, int ano, int hora, int minuto, string local, string cpf) {
Evento evento = { nome, dia, mes, ano, hora, minuto, local, cpf} ;
eventos.push_back ( evento) ;
cout << "Evento adicionado com sucesso!" << endl;
}
// Método para listar eventos próximos
void verificarEventosProximos( ) {
time_t now = time ( 0 ) ;
tm * ltm = localtime ( & now) ;
int diaAtual = ltm- > tm_mday;
int mesAtual = ltm- > tm_mon + 1 ;
int anoAtual = ltm- > tm_year + 1900 ;
int horaAtual = ltm- > tm_hour;
int minutoAtual = ltm- > tm_min;
cout << "Eventos próximos:" << endl;
bool encontrouEvento = false ;
// Verifica os eventos próximos à data e hora atual
for ( const Evento& evento : eventos) {
if ( evento.ano > anoAtual || ( evento.ano == anoAtual && evento.mes > mesAtual) ||
( evento.ano == anoAtual && evento.mes == mesAtual && evento.dia > diaAtual) ||
( evento.ano == anoAtual && evento.mes == mesAtual && evento.dia == diaAtual && evento.hora > horaAtual) ||
( evento.ano == anoAtual && evento.mes == mesAtual && evento.dia == diaAtual && evento.hora == horaAtual && evento.minuto > minutoAtual) ) {
cout << "Evento: " << evento.nome << endl;
cout << "Data: " << evento.dia << "/" << evento.mes << "/" << evento.ano << endl;
cout << "Hora: " << evento.hora << ":" << evento.minuto << endl;
cout << "Local: " << evento.local << endl;
cout << "CPF: " << evento.cpf << endl;
cout << "---------------------------" << endl;
encontrouEvento = true ;
}
}
if ( ! encontrouEvento) {
cout << "Nenhum evento próximo encontrado." << endl;
}
}
// Método para listar eventos passados
void verificarEventosPassados( ) {
time_t now = time ( 0 ) ;
tm * ltm = localtime ( & now) ;
int diaAtual = ltm- > tm_mday;
int mesAtual = ltm- > tm_mon + 1 ;
int anoAtual = ltm- > tm_year + 1900 ;
int horaAtual = ltm- > tm_hour;
int minutoAtual = ltm- > tm_min;
cout << "Eventos passados:" << endl;
bool encontrouEvento = false ;
// Verifica os eventos passados à data e hora atual
for ( const Evento& evento : eventos) {
if ( evento.ano < anoAtual || ( evento.ano == anoAtual && evento.mes < mesAtual) ||
( evento.ano == anoAtual && evento.mes == mesAtual && evento.dia < diaAtual) ||
( evento.ano == anoAtual && evento.mes == mesAtual && evento.dia == diaAtual && evento.hora < horaAtual) ||
( evento.ano == anoAtual && evento.mes == mesAtual && evento.dia == diaAtual && evento.hora == horaAtual && evento.minuto < minutoAtual) ) {
cout << "Evento: " << evento.nome << endl;
cout << "Data: " << evento.dia << "/" << evento.mes << "/" << evento.ano << endl;
cout << "Hora: " << evento.hora << ":" << evento.minuto << endl;
cout << "Local: " << evento.local << endl;
cout << "CPF: " << evento.cpf << endl;
cout << "---------------------------" << endl;
encontrouEvento = true ;
}
}
if ( ! encontrouEvento) {
cout << "Nenhum evento passado encontrado." << endl;
}
}
// Método para preencher eventos já existentes
void preencherEventosExistentes( ) {
// Preenchendo com os dados do calendário de eventos
adicionarEvento( "Júnior Delfino" , 14 , 12 , 2024 , 12 , 0 , "Avenida Rondon Pacheco, 345, cobertura (Edifício Rondon Praia)" , "CPF1" ) ;
adicionarEvento( "Terça da Serra Residencial Senior Uberlândia LTDA" , 20 , 12 , 2024 , 16 , 0 , "Av. Oscarina Cunha Chaves, 510 - Spazio Unigarden" , "CPF2" ) ;
adicionarEvento( "Reila Rocha" , 24 , 12 , 2024 , 20 , 0 , "Rua da Costureira 961 B: Planalto" , "CPF3" ) ;
adicionarEvento( "Alessandra Ferreira de Medeiros" , 31 , 12 , 2024 , 19 , 0 , "Rua das Cerejeiras 648, Bairro Jaraguá" , "CPF4" ) ;
adicionarEvento( "Marcos Stringueta Benante" , 31 , 12 , 2024 , 18 , 0 , "Rua das Cerejeiras N°648, Bairro Jaraguá, Uberlândia MG" , "CPF5" ) ;
adicionarEvento( "Camila Pinheiro Botelho Costa" , 17 , 1 , 2025 , 9 , 0 , "Rua das Acácias 526, Condomínio Morada do Sol" , "CPF6" ) ;
adicionarEvento( "Jessica Duarte Prado" , 18 , 1 , 2025 , 0 , 0 , "Rua Josephina de Souza Leite, 78, Bairro Nova Uberlândia" , "CPF7" ) ;
adicionarEvento( "Jessica Alves Silva" , 24 , 1 , 2025 , 21 , 30 , "Rua Marceliro Bertoldo 713" , "CPF8" ) ;
adicionarEvento( "Danielle Boaventura da Silva" , 31 , 1 , 2025 , 20 , 0 , "Rua Silvio Romero 297, Minas Gerais" , "CPF9" ) ;
adicionarEvento( "Wanessa Rocha de Medeiros" , 8 , 2 , 2025 , 17 , 0 , "Rua Pio XII, N700, JD Ozanan" , "CPF10" ) ;
adicionarEvento( "João Pedro Dias Vieira" , 22 , 2 , 2025 , 11 , 0 , "R. Aurílio Pereira Carvalho 130, Granada" , "CPF11" ) ;
adicionarEvento( "Nayara de Oliveira Silva" , 8 , 3 , 2025 , 19 , 0 , "Rua Marcelino Bertoldo 1749, Morada Nova" , "CPF12" ) ;
adicionarEvento( "Marines Barbosa de Freitas" , 8 , 3 , 2025 , 8 , 0 , "Carmo Gifoni 1500, Park Martins" , "CPF13" ) ;
adicionarEvento( "Marines Barbosa de Freitas" , 14 , 4 , 2025 , 8 , 0 , "Carmo Gifoni 1500, Park Martins" , "CPF14" ) ;
adicionarEvento( "Natalia de Fátima Bragança" , 15 , 3 , 2025 , 14 , 0 , "Rua Felisberto Carrijo, 857, Fundinho" , "CPF15" ) ;
adicionarEvento( "Mayara Alves de Arruda" , 22 , 3 , 2025 , 18 , 0 , "Rua dos Ceamitas 430" , "CPF16" ) ;
adicionarEvento( "Deiziane Assunção Dutra" , 22 , 3 , 2025 , 20 , 0 , "Localização no Google Maps" , "CPF17" ) ;
adicionarEvento( "Lucas Chaves Lima" , 25 , 3 , 2025 , 18 , 0 , "Rua Santos Dumont, 800, Ap 104, Centro" , "CPF18" ) ;
adicionarEvento( "Tatiana Gomes Dias" , 29 , 3 , 2025 , 12 , 0 , "Avenida do Himalaia, 245, Esquina com Alameda dos Pirineus" , "CPF19" ) ;
adicionarEvento( "Claiton Alves Oliveira" , 12 , 4 , 2025 , 12 , 0 , "Rua José Vidoto 601, Chácara do Bola" , "CPF20" ) ;
adicionarEvento( "Fabricia Diniz Oliveira de Andrade" , 26 , 4 , 2025 , 19 , 0 , "Rua Manoelina da Silva Mendes, Morada Nova" , "CPF21" ) ;
adicionarEvento( "Aline Rodrigues Pires" , 10 , 5 , 2025 , 13 , 0 , "Av. Mato Grosso 3464, Umuarama" , "CPF22" ) ;
adicionarEvento( "Tiago Costa Prado" , 17 , 5 , 2025 , 21 , 0 , "Rua Valdomira Pimenta, 979, Chácara Panorama" , "CPF23" ) ;
adicionarEvento( "Maria Eduarda Alves" , 30 , 5 , 2025 , 19 , 30 , "Horácio Rezende 440, Daniel Fonseca" , "CPF24" ) ;
adicionarEvento( "Gustavo Gomes Borges" , 27 , 6 , 2025 , 19 , 0 , "Rua Alfredo Bosi 529" , "CPF25" ) ;
}
} ;
int main( ) {
CalendarioEventos calendario;
int opcao;
// Preenche os eventos já existentes
calendario.preencherEventosExistentes ( ) ;
do {
// Menu de opções
cout << "Escolha uma opção: " << endl;
cout << "1 - Adicionar evento" << endl;
cout << "2 - Verificar eventos próximos" << endl;
cout << "3 - Verificar eventos passados" << endl;
cout << "0 - Sair" << endl;
cin >> opcao;
cin .ignore ( ) ; // Ignora o newline após o número da opção
if ( opcao == 1 ) {
string nome, local, cpf;
int dia, mes, ano, hora, minuto;
// Solicita os dados do evento
cout << "Digite o nome do evento: " ;
getline( cin , nome) ;
cout << "Digite a data do evento (dia/mês/ano): " ;
cin >> dia >> mes >> ano;
cout << "Digite a hora do evento (hora:minuto): " ;
cin >> hora >> minuto;
cin .ignore ( ) ; // Ignora o newline após a hora e minuto
cout << "Digite o local do evento: " ;
getline( cin , local) ;
cout << "Digite o CPF do organizador: " ;
getline( cin , cpf) ;
// Adiciona o evento
calendario.adicionarEvento ( nome, dia, mes, ano, hora, minuto, local, cpf) ;
}
else if ( opcao == 2 ) {
// Verifica e exibe eventos próximos
calendario.verificarEventosProximos ( ) ;
}
else if ( opcao == 3 ) {
// Verifica e exibe eventos passados
calendario.verificarEventosPassados ( ) ;
}
} while ( opcao ! = 0 ) ;
return 0 ;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8c3RyaW5nPgojaW5jbHVkZSA8Y3RpbWU+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKc3RydWN0IEV2ZW50byB7CiAgICBzdHJpbmcgbm9tZTsKICAgIGludCBkaWEsIG1lcywgYW5vLCBob3JhLCBtaW51dG87CiAgICBzdHJpbmcgbG9jYWw7CiAgICBzdHJpbmcgY3BmOwp9OwoKY2xhc3MgQ2FsZW5kYXJpb0V2ZW50b3Mgewpwcml2YXRlOgogICAgdmVjdG9yPEV2ZW50bz4gZXZlbnRvczsKCnB1YmxpYzoKICAgIC8vIE3DqXRvZG8gcGFyYSBhZGljaW9uYXIgZXZlbnRvIGNvbSBkYWRvcyBwZXJzb25hbGl6YWRvcwogICAgdm9pZCBhZGljaW9uYXJFdmVudG8oc3RyaW5nIG5vbWUsIGludCBkaWEsIGludCBtZXMsIGludCBhbm8sIGludCBob3JhLCBpbnQgbWludXRvLCBzdHJpbmcgbG9jYWwsIHN0cmluZyBjcGYpIHsKICAgICAgICBFdmVudG8gZXZlbnRvID0ge25vbWUsIGRpYSwgbWVzLCBhbm8sIGhvcmEsIG1pbnV0bywgbG9jYWwsIGNwZn07CiAgICAgICAgZXZlbnRvcy5wdXNoX2JhY2soZXZlbnRvKTsKICAgICAgICBjb3V0IDw8ICJFdmVudG8gYWRpY2lvbmFkbyBjb20gc3VjZXNzbyEiIDw8IGVuZGw7CiAgICB9CgogICAgLy8gTcOpdG9kbyBwYXJhIGxpc3RhciBldmVudG9zIHByw7N4aW1vcwogICAgdm9pZCB2ZXJpZmljYXJFdmVudG9zUHJveGltb3MoKSB7CiAgICAgICAgdGltZV90IG5vdyA9IHRpbWUoMCk7CiAgICAgICAgdG0gKmx0bSA9IGxvY2FsdGltZSgmbm93KTsKCiAgICAgICAgaW50IGRpYUF0dWFsID0gbHRtLT50bV9tZGF5OwogICAgICAgIGludCBtZXNBdHVhbCA9IGx0bS0+dG1fbW9uICsgMTsKICAgICAgICBpbnQgYW5vQXR1YWwgPSBsdG0tPnRtX3llYXIgKyAxOTAwOwogICAgICAgIGludCBob3JhQXR1YWwgPSBsdG0tPnRtX2hvdXI7CiAgICAgICAgaW50IG1pbnV0b0F0dWFsID0gbHRtLT50bV9taW47CgogICAgICAgIGNvdXQgPDwgIkV2ZW50b3MgcHLDs3hpbW9zOiIgPDwgZW5kbDsKICAgICAgICBib29sIGVuY29udHJvdUV2ZW50byA9IGZhbHNlOwoKICAgICAgICAvLyBWZXJpZmljYSBvcyBldmVudG9zIHByw7N4aW1vcyDDoCBkYXRhIGUgaG9yYSBhdHVhbAogICAgICAgIGZvciAoY29uc3QgRXZlbnRvJiBldmVudG8gOiBldmVudG9zKSB7CiAgICAgICAgICAgIGlmIChldmVudG8uYW5vID4gYW5vQXR1YWwgfHwgKGV2ZW50by5hbm8gPT0gYW5vQXR1YWwgJiYgZXZlbnRvLm1lcyA+IG1lc0F0dWFsKSB8fCAKICAgICAgICAgICAgICAgIChldmVudG8uYW5vID09IGFub0F0dWFsICYmIGV2ZW50by5tZXMgPT0gbWVzQXR1YWwgJiYgZXZlbnRvLmRpYSA+IGRpYUF0dWFsKSB8fAogICAgICAgICAgICAgICAgKGV2ZW50by5hbm8gPT0gYW5vQXR1YWwgJiYgZXZlbnRvLm1lcyA9PSBtZXNBdHVhbCAmJiBldmVudG8uZGlhID09IGRpYUF0dWFsICYmIGV2ZW50by5ob3JhID4gaG9yYUF0dWFsKSB8fAogICAgICAgICAgICAgICAgKGV2ZW50by5hbm8gPT0gYW5vQXR1YWwgJiYgZXZlbnRvLm1lcyA9PSBtZXNBdHVhbCAmJiBldmVudG8uZGlhID09IGRpYUF0dWFsICYmIGV2ZW50by5ob3JhID09IGhvcmFBdHVhbCAmJiBldmVudG8ubWludXRvID4gbWludXRvQXR1YWwpKSB7CiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIGNvdXQgPDwgIkV2ZW50bzogIiA8PCBldmVudG8ubm9tZSA8PCBlbmRsOwogICAgICAgICAgICAgICAgY291dCA8PCAiRGF0YTogIiA8PCBldmVudG8uZGlhIDw8ICIvIiA8PCBldmVudG8ubWVzIDw8ICIvIiA8PCBldmVudG8uYW5vIDw8IGVuZGw7CiAgICAgICAgICAgICAgICBjb3V0IDw8ICJIb3JhOiAiIDw8IGV2ZW50by5ob3JhIDw8ICI6IiA8PCBldmVudG8ubWludXRvIDw8IGVuZGw7CiAgICAgICAgICAgICAgICBjb3V0IDw8ICJMb2NhbDogIiA8PCBldmVudG8ubG9jYWwgPDwgZW5kbDsKICAgICAgICAgICAgICAgIGNvdXQgPDwgIkNQRjogIiA8PCBldmVudG8uY3BmIDw8IGVuZGw7CiAgICAgICAgICAgICAgICBjb3V0IDw8ICItLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0iIDw8IGVuZGw7CiAgICAgICAgICAgICAgICBlbmNvbnRyb3VFdmVudG8gPSB0cnVlOwogICAgICAgICAgICB9CiAgICAgICAgfQoKICAgICAgICBpZiAoIWVuY29udHJvdUV2ZW50bykgewogICAgICAgICAgICBjb3V0IDw8ICJOZW5odW0gZXZlbnRvIHByw7N4aW1vIGVuY29udHJhZG8uIiA8PCBlbmRsOwogICAgICAgIH0KICAgIH0KCiAgICAvLyBNw6l0b2RvIHBhcmEgbGlzdGFyIGV2ZW50b3MgcGFzc2Fkb3MKICAgIHZvaWQgdmVyaWZpY2FyRXZlbnRvc1Bhc3NhZG9zKCkgewogICAgICAgIHRpbWVfdCBub3cgPSB0aW1lKDApOwogICAgICAgIHRtICpsdG0gPSBsb2NhbHRpbWUoJm5vdyk7CgogICAgICAgIGludC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hbCkpIHsKICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgY291dCA8PCAiRXZlbnRvOiAiIDw8IGV2ZW50by5ub21lIDw8IGVuZGw7CiAgICAgICAgICAgICAgICBjb3V0IDw8ICJEYXRhOiAiIDw8IGV2ZW50by5kaWEgPDwgIi8iIDw8IGV2ZW50by5tZXMgPDwgIi8iIDw8IGV2ZW50by5hbm8gPDwgZW5kbDsKICAgICAgICAgICAgICAgIGNvdXQgPDwgIkhvcmE6ICIgPDwgZXZlbnRvLmhvcmEgPDwgIjoiIDw8IGV2ZW50by5taW51dG8gPDwgZW5kbDsKICAgICAgICAgICAgICAgIGNvdXQgPDwgIkxvY2FsOiAiIDw8IGV2ZW50by5sb2NhbCA8PCBlbmRsOwogICAgICAgICAgICAgICAgY291dCA8PCAiQ1BGOiAiIDw8IGV2ZW50by5jcGYgPDwgZW5kbDsKICAgICAgICAgICAgICAgIGNvdXQgPDwgIi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSIgPDwgZW5kbDsKICAgICAgICAgICAgICAgIGVuY29udHJvdUV2ZW50byA9IHRydWU7CiAgICAgICAgICAgIH0KICAgICAgICB9CgogICAgICAgIGlmICghZW5jb250cm91RXZlbnRvKSB7CiAgICAgICAgICAgIGNvdXQgPDwgIk5lbmh1bSBldmVudG8gcGFzc2FkbyBlbmNvbnRyYWRvLiIgPDwgZW5kbDsKICAgICAgICB9CiAgICB9CgogICAgLy8gTcOpdG9kbyBwYXJhIHByZWVuY2hlciBldmVudG9zIGrDoSBleGlzdGVudGVzCiAgICB2b2lkIHByZWVuY2hlckV2ZW50b3NFeGlzdGVudGVzKCkgewogICAgICAgIC8vIFByZWVuY2hlbmRvIGNvbSBvcyBkYWRvcyBkbyBjYWxlbmTDoXJpbyBkZSBldmVudG9zCiAgICAgICAgYWRpY2lvbmFyRXZlbnRvKCJKw7puaW9yIERlbGZpbm8iLCAxNCwgMTIsIDIwMjQsIDEyLCAwLCAiQXZlbmlkYSBS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vIE1lbnUgZGUgb3DDp8O1ZXMKICAgICAgICBjb3V0IDw8ICJFc2NvbGhhIHVtYSBvcMOnw6NvOiAiIDw8IGVuZGw7CiAgICAgICAgY291dCA8PCAiMSAtIEFkaWNpb25hciBldmVudG8iIDw8IGVuZGw7CiAgICAgICAgY291dCA8PCAiMiAtIFZlcmlmaWNhciBldmVudG9zIHByw7N4aW1vcyIgPDwgZW5kbDsKICAgICAgICBjb3V0IDw8ICIzIC0gVmVyaWZpY2FyIGV2ZW50b3MgcGFzc2Fkb3MiIDw8IGVuZGw7CiAgICAgICAgY291dCA8PCAiMCAtIFNhaXIiIDw8IGVuZGw7CiAgICAgICAgY2luID4+IG9wY2FvOwogICAgICAgIGNpbi5pZ25vcmUoKTsgIC8vIElnbm9yYSBvIG5ld2xpbmUgYXDDs3MgbyBuw7ptZXJvIGRhIG9ww6fDo28KCiAgICAgICAgaWYgKG9wY2FvID09IDEpIHsKICAgICAgICAgICAgc3RyaW5nIG5vbWUsIGxvY2FsLCBjcGY7CiAgICAgICAgICAgIGludCBkaWEsIG1lcywgYW5vLCBob3JhLCBtaW51dG87CgogICAgICAgICAgICAvLyBTb2xpY2l0YSBvcyBkYWRvcyBkbyBldmVudG8KICAgICAgICAgICAgY291dCA8PCAiRGlnaXRlIG8gbm9tZSBkbyBldmVudG86ICI7CiAgICAgICAgICAgIGdldGxpbmUoY2luLCBub21lKTsKICAgICAgICAgICAgY291dCA8PCAiRGlnaXRlIGEgZGF0YSBkbyBldmVudG8gKGRpYS9tw6pzL2Fubyk6ICI7CiAgICAgICAgICAgIGNpbiA+PiBkaWEgPj4gbWVzID4+IGFubzsKICAgICAgICAgICAgY291dCA8PCAiRGlnaXRlIGEgaG9yYSBkbyBldmVudG8gKGhvcmE6bWludXRvKTogIjsKICAgICAgICAgICAgY2luID4+IGhvcmEgPj4gbWludXRvOwogICAgICAgICAgICBjaW4uaWdub3JlKCk7ICAvLyBJZ25vcmEgbyBuZXdsaW5lIGFww7NzIGEgaG9yYSBlIG1pbnV0bwogICAgICAgICAgICBjb3V0IDw8ICJEaWdpdGUgbyBsb2NhbCBkbyBldmVudG86ICI7CiAgICAgICAgICAgIGdldGxpbmUoY2luLCBsb2NhbCk7CiAgICAgICAgICAgIGNvdXQgPDwgIkRpZ2l0ZSBvIENQRiBkbyBvcmdhbml6YWRvcjogIjsKICAgICAgICAgICAgZ2V0bGluZShjaW4sIGNwZik7CgogICAgICAgICAgICAvLyBBZGljaW9uYSBvIGV2ZW50bwogICAgICAgICAgICBjYWxlbmRhcmlvLmFkaWNpb25hckV2ZW50byhub21lLCBkaWEsIG1lcywgYW5vLCBob3JhLCBtaW51dG8sIGxvY2FsLCBjcGYpOwogICAgICAgIH0KICAgICAgICBlbHNlIGlmIChvcGNhbyA9PSAyKSB7CiAgICAgICAgICAgIC8vIFZlcmlmaWNhIGUgZXhpYmUgZXZlbnRvcyBwcsOzeGltb3MKICAgICAgICAgICAgY2FsZW5kYXJpby52ZXJpZmljYXJFdmVudG9zUHJveGltb3MoKTsKICAgICAgICB9CiAgICAgICAgZWxzZSBpZiAob3BjYW8gPT0gMykgewogICAgICAgICAgICAvLyBWZXJpZmljYSBlIGV4aWJlIGV2ZW50b3MgcGFzc2Fkb3MKICAgICAgICAgICAgY2FsZW5kYXJpby52ZXJpZmljYXJFdmVudG9zUGFzc2Fkb3MoKTsKICAgICAgICB9CiAgICB9IHdoaWxlIChvcGNhbyAhPSAwKTsKCiAgICByZXR1cm4gMDsKfQo=