leandrobaum / Trabalho2

Trabalho da disciplina de programação exercício 3.14
0 stars 1 forks source link

carregar e printar #3

Open hamudy1 opened 5 years ago

hamudy1 commented 5 years ago
hamudy1 commented 5 years ago

include

include

using namespace std;

int main() { time_t timer; struct tm *horarioLocal;

time(&timer); // Obtem informações de data e hora horarioLocal = localtime(&timer); // Converte a hora atual para a hora local

int dia = horarioLocal->tm_mday; int mes = horarioLocal->tm_mon + 1; int ano = horarioLocal->tm_year + 1900;

int hora = horarioLocal->tm_hour; int min = horarioLocal->tm_min; int sec = horarioLocal->tm_sec;

cout << "Horário: " << (hora-2) << ":" << min << ":" << sec << endl; cout << "Data: " << dia << "/" << mes << "/" << ano << endl;

return 0; }