checks day and month to reference database now

This commit is contained in:
Daniel Jones 2023-09-19 14:39:25 -05:00
parent f7597a8e75
commit 08d97563fb

View File

@ -8,15 +8,13 @@
#include "mainwindow.h"
#include "./ui_mainwindow.h"
#include <windows.h>
#include <iostream>
#include <random>
QString verse_display();
std::string verse_grab(int day);
std::string verse_grab();
MainWindow::MainWindow(QWidget *parent)
@ -33,19 +31,14 @@ MainWindow::~MainWindow()
delete ui;
}
//As name implies, randomly chooses a number between 1 and 100.
int random_verse(){
std::random_device rd;
std:: uniform_int_distribution<int> dist(1, 100);
return dist(rd);
}
//This is the function that will load the verse into the program.
QString verse_display()
{
std::string verse_text;
int verse_day = random_verse();
verse_text = verse_grab(verse_day);
verse_text = verse_grab();
QString returned_string = QString::fromStdString(verse_text);
@ -53,17 +46,22 @@ QString verse_display()
}
std::string verse_grab(int day){
std::string verse_grab(){
//Windows way of getting current month and time.
SYSTEMTIME st = {0};
GetLocalTime(&st);
int cur_day = st.wDay;
int cur_month = st.wMonth;
std::string my_verse;
my_verse = "Hello, this is a verse!";
return my_verse;
}
void MainWindow::on_exitButton_clicked()
{
QApplication::quit();