Can I use C++ for a lottery app

Alla c.a. supporto free code camp,

ho visto i tuoi video su C++ e mi sono piaciuti.

Ho conoscenze nel mondo informatico (conosco il linguaggio Cobol, che pero’ non e’ adatto al mondo della lotteria italiana )ma, chiedo se puoi aiutarmi.

Vorrei realizzare dei programmi per il lotto (lotteria italiana, con 90 numeri).

Da te vorrei sapere se il linguaggio C++ si presta bene alle operazioni ed e’ un linguaggio di facile apprendimento.

In alternativa, ho visto altri in Italia, che hanno realizzato programmi in Visual Basic o se fosse semplice da realizzare, mi andrebbe anche bene il Phyton.

Le 2 cose indispensabili che da solo non riesco a costruire, sono :

1°) Una routine per estrarre i dati dal sito ufficiale della Lottomatica Italia e poter aggiornare i dati automaticamente, ogni volta che vi siano le estrazioni.

2°) Una routine che mi controlli glli esiti o i risultati delle estrazioni : ambata=1 estratto, ambo=2 estratti, terno= 3 estratti, quaterna= 4 estratti, cinquina= 5 estratti e cosi’ via.

Pensi di potermi aiutare ?

Grazie per eventuale risposta.

Nelson

Hi support free code Camp, I saw your videos on C ++ and I liked them. I have knowledge in the computer world (I know the Cobol language, which however is not suitable for the Italian lottery world) but, I ask if you can help me. for the lotto (Italian lottery, with 90 numbers). From you I would like to know if the C ++ language lends itself well to operations and is an easy to learn language. Alternatively, I have seen others in Italy, who have created programs in Visual Basic or if it were simple to make, the Phyton would also be fine. The 2 indispensable things that I cannot build by myself are: 1 °) A routine to extract data from the official website of Lottomatica Italia and be able to update the data automatically, every time there are extractions. 2) A routine that checks me the results or results of extractions: ambata = 1 extract, both = 2 extracts, terno = 3 extracts, quatern = 4 extracts, five = 5 extracts and so on You think you can i help? Thanks for any reply. Nelson

Hi, I’ve changed your thread title to describe your problem more clearly. Descriptive titles, such as “Why does my function return undefined?”, are more likely to elicit helpful responses than generic titles, such as “Help please”.

Hi @studente1331, I will reply in English so it can be beneficial to more reader:

Da te vorrei sapere se il linguaggio C++ si presta bene alle operazioni ed e’ un linguaggio di facile apprendimento.

Not really to both question. C++ is a low level language often used for memory and performance critical apps. It is generally considered a hard to learn language.
Of course if this is the language you already know, than nothing will stop you from using it.

Una routine per estrarre i dati dal sito ufficiale della Lottomatica Italia e poter aggiornare i dati automaticamente, ogni volta che vi siano le estrazioni.

You can achieve this with a simple web scraper. Every language has a library dedicated for this task. From what I know and see around one of the most used is a Python library called BeautifulSoup.

Una routine che mi controlli glli esiti o i risultati delle estrazioni

Not really sure what kind of data is available from Lottomatica, but you can either scrape it from the website, or see it they have a public API.


If you are starting from zero my suggestion is to choose between either Python or Node, for this kind of operation.
However it’s highly likely that there’s a library for that in COBOL as well. :slight_smile:

A quick google-fu gave me back this result for further reading:

A Node.js guide:

A collection of Python web scraping tutorials:

Hope it helps :sparkles:

edit:

On Github I have found this:
(disclaimer, I am in any capacity affiliated with this repo)

Ciao Marmiz. Grazie per il tuo intervento iniziale. E’ vero che il C++ e’ il linguaggio macchina piu’ veloce rispetto a tutti gli altri, soprattutto per chi come me, dovra’ gestire milioni di combinazioni ? Secondo il tuo suggerimento, sarebbe comunque consigliabile imparare ed utilizzare il Python ? E’ giusto ? E’ adatto per i tempi di risposta. su elaborazioni di milioni di combinazioni ? Si presta facilmente nella realizzazione delle parti grafiche ? Quale corso percio’ mi consigli di seguire, non avendo necessita’ di realizzare siti web ma, semplicemente importare dati dal sito della Lottomatica Italia e poi gestirli con algoritmi appropriati ? Cerca percio’ di farmi compiere il percorso piu’ completo ed adatto possibile, racchiudendo le importazioni dei dati e la creazione della veste grafica. Grazie ancora per la tua risposta. Nelson
Hello Marmiz. Thanks for your initial intervention. Is it true that C ++ is the fastest machine language compared to all the others, especially for those like me who will have to manage millions of combinations? According to your suggestion, would it still be advisable to learn and use Python? It’s right ? It is suitable for response times. on the elaboration of millions of combinations? It lends itself easily in the creation of graphic parts? Which course do you advise me to follow, since I don’t need to create websites but simply import data from the Lottomatica Italia website and then manage them with appropriate algorithms? Therefore try to make me complete the most complete and suitable path possible, including the data imports and the creation of the graphic layout. Thanks again for your reply. Nelson

I wouldn’t use C++ to scrape data from a website. When it comes to speed, there are plenty of Python packages that call through to C/C++ or CUDA implementations to provide high performance for large scale data analysis.

C/C++ is indeed fast, but I advise using a higher level language whenever you can.

Hello Marmiz.
Thanks for the suggestions you have provided me.
I specify and clarify my request a little better.
The following app obtained from Github for the user fernandod1, is not suitable for my scraper, since even if it is from Lottomatica Italia, it manages the extractions every 5 minutes and I don’t need this.


What I need instead, are the weekly draws (3 times a week: Tuesday, Thursday, Saturday) which manage 11 wheels having 5 draws in each of them.

What I sent you is yesterday’s draw, January 9, 2021.
The following is instead the complete archive of the extractions, starting from 1939 and which must be suitably updated automatically, extraction, after extraction.
It is the history of all past extractions.
It will need to be read only once and then proceed with automatic updates that occur weekly, 3 times …
If you scroll the page, you will see it.
[from '39 to today (422k)]
If you think you can help me or point out someone who can, I am grateful to you.
Thanks.
Nelson

Hi @studente1331,

That repo’s purpose was mainly to serve an example, you should be able to pick up some ideas and tweak them to your needs.

For example, that script’s timing is based on a Cron schedule, it’s pretty trivial to have your runs on that specific days.

Same goes with the page: it’s a simple matter of scraping then have your scraper run based on said schedule.


What have you tried building so far to achieve your goal?
You will probably have better chances in getting help if you have something to show rather than simply “blindly” ask.

1 Like

Ciao Marmiz. Proseguo per cercare di far funzionare il programma di Fernandod1 (github) dedicato alla LottomaticaItalia. Ho il sistema operativo Windows7 Home Premium. Ho installato Python 3.8.8 Ho installato Mysql 8.0.23.0 Tutte le installazioni sono state eseguite senza errori. Poi ho eseguito le correzioni di Fernandod1 (note informative, modificando Host, database name, user, password) e nonostante cio’ quando vado a caricare lo script su Mysql mi dice che non e’ supportato. Tutte le operazioni che ho eseguito, vanno bene ? Le versioni dei software’s che ho installato, sono compatibili con lo script di Fernandod1 ? Le versioni del sistema operativo (Windows7 a 64 bit), di Python 3.8.8 e MySQL 8.0.23.0, sono tra questi 3 perfettamente compatibili tra di loro ? A questo punto, cosa mi consigli ?
Hello Marmiz. I continue to try to make the Fernandod1 (github) program dedicated to LottomaticaItalia work. I have the Windows7 Home Premium operating system. I installed Python 3.8.8 I installed Mysql 8.0.23.0 All installations were done without errors. Then I made the fixes of Fernandod1 (informative notes, modifying Host, database name, user, password) and nevertheless when I go to upload the script on Mysql it tells me that it is not supported. Are all the operations I performed okay? Are the versions of the software’s I installed compatible with the Fernandod1 script? The versions of the operating system (Windows7 64-bit), of Python 3.8.8 and MySQL 8.0.23.0, are among these 3 perfectly compatible with each other? At this point, what do you advise me?

that is a php script, not python, do you have php?

Non ho php. Cosa devo installare per far girare Fernandod1 ?
I don’t have php. What do I need to install to run Fernandod1?

Il file in quella repository è un file *.php, se non hai il linguaggio php, che è una server-side language, non puoi usarlo