diff --git a/TPSI/costanzo_francesco/.gitignore b/TPSI/costanzo_francesco/.gitignore new file mode 100644 index 00000000..6d1767fc --- /dev/null +++ b/TPSI/costanzo_francesco/.gitignore @@ -0,0 +1 @@ +**/.idea/ diff --git a/TPSI/costanzo_francesco/.gitkeep b/TPSI/costanzo_francesco/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/TPSI/costanzo_francesco/css/esercizio_css_18/costanzo_esercizio_css_18.css b/TPSI/costanzo_francesco/css/esercizio_css_18/costanzo_esercizio_css_18.css new file mode 100644 index 00000000..113580b7 --- /dev/null +++ b/TPSI/costanzo_francesco/css/esercizio_css_18/costanzo_esercizio_css_18.css @@ -0,0 +1,30 @@ +div { + background-color: lightblue; + color:navy; + border-top: 15px solid navy; + border-bottom: 15px solid navy; + } + + #div1 { + width: 100px; + padding: 25px; + border: 25px solid navy; + margin-bottom: 2rem; + } + + #div2 { + width: 250px; + padding-left: 15px; + padding-right: 10px; + border-left: 10px solid navy; + border-right: 15px solid navy; + margin-bottom: 2rem; + } + + #div3 { + width: 353px; + padding-left: 1px; + padding-right: 19px; + border-left: 14px solid navy; + border-right: 21px solid navy; + } \ No newline at end of file diff --git a/TPSI/costanzo_francesco/css/esercizio_css_18/costanzo_esercizio_css_18.html b/TPSI/costanzo_francesco/css/esercizio_css_18/costanzo_esercizio_css_18.html new file mode 100644 index 00000000..9f6db7bf --- /dev/null +++ b/TPSI/costanzo_francesco/css/esercizio_css_18/costanzo_esercizio_css_18.html @@ -0,0 +1,13 @@ + +
+ + + +
+ The local loopback mechanism may be used to run a network service on a
+ host without requiring a physical network interface, or without making the
+ service accessible from the networks the computer may be connected to. For
+ example, a locally installed website may be accessed from a Web browser by
+ the URL http://localhost to display its home page. The name localhost
+ normally resolves to the IPv4 loopback address 127.0.0.1, and to the
+ IPv6
+ loopback address ::1.
+
+ “I computer sono incredibilmente veloci, accurati e stupidi. Gli uomini sono incredibilmente lenti,
+ inaccurati e intelligenti. L'insieme dei due costituisce una forza incalcolabile.”
Albert Einstain
+
+ IPv4
+ network
+ standards reserve the entire address block
+ 127.0.0.0/8 (more than 16 million addresses) for loopback purposes.[2]
+ That means any packet sent to any of those addresses is looped back. The
+ address 127.0.0.1 is the standard address for IPv4
+ loopback
+ traffic; the rest are not supported by all operating systems. However,
+ they can be used to set up multiple server applications on the host, all
+ listening on the same port number. The IPv6 standard assigns only a single
+ address for loopback: ::1. The resolution of the name localhost to one or
+ more IP addresses is normally configured by the following lines in the
+ operating system's hosts file:IPv4 network standards reserve the entire
+ address block 127.0.0.0/8 (more than 16 million addresses) for loopback
+ purposes.[2] That means any packet sent
+ to any of those addresses is looped back. The address 127.0.0.1 is the
+ standard address for IPv4 loopback traffic; the rest are not supported by
+ all operating systems. However, they can be used to set up multiple server
+ applications on the host, all listening on the same port number. The IPv6
+ standard assigns only a single address for loopback: ::1. The resolution
+ of the name localhost to one or more IP addresses is normally configured
+ by the following lines in the operating system's hosts file:
+ 127.0.0.1 localhost
+ ::1 localhost
+ 127.0.0.1 localhost
+ ::1 localhost
+
+
+
+ The name may also be resolved by Domain Name System (DNS) servers, but
+ queries for this name should be resolved locally, and should not be
+ forwarded to remote name servers.
+
+ In addition to the mapping of localhost to the loopback addresses
+ (127.0.0.1 and ::1), localhost may also be mapped to other IPv4 (loopback)
+ addresses and it is also possible to assign other, or additional, names to
+ any loopback address. The mapping of localhost to addresses other than the
+ designated loopback address range in the hosts file or in DNS is not
+ guaranteed to have the desired effect, as applications may map the name
+ internally.
+
+ In the Domain Name
+ System, the name localhost is reserved as a top-level domain name, originally
+ set aside to avoid confusion with the hostname used for loopback
+ purposes.[3] IETF standards prohibit domain name registrars from assigning
+ the name localhost.
+
+
+
+ The name localhost is reserved for loopback purposes by RFC 6761
+ (Special-Use Domain Names),[4] which achieved the Proposed Standard
+ maturity level in February 2013. The standard sets forth a number of
+ special considerations governing the use of the name in the Domain Name
+ System:
+
+
+
+ An IPv4 or IPv6 address query for the name localhost must always resolve
+ to the respective loopback address, which is specified in a separate
+ standard. Applications may resolve the name to a loopback address
+ themselves, or pass it to the local name resolver mechanisms. When a name
+ resolver receives an address (A or AAAA) query for localhost, it should
+ return the appropriate loopback addresses, and negative responses for any
+ other requested record types. Queries for localhost should not be sent to
+ caching name servers. To avoid burdening the Domain Name System root
+ servers with traffic, caching name servers should never request name
+ server records for localhost, or forward resolution to authoritative name
+ servers. DNS registrars are precluded from delegating domain names in the
+ top-level domain localhost. When
+ name servers receive queries for
+ 'localhost' in spite of the provisions mentioned resolve them
+ appropriately. The IPv4 loopback addresses are reserved within the IPv4
+ address space by the IETF
"Special Use IPv4 Addresses" standard (RFC
+ 5735).[5] The reservation can be traced back to the November 1986
+ "Assigned Numbers" standard (RFC 990).
+
+ “Chiunque consideri i metodi aritmetici metodi di produrre numeri casuali è, naturalmente, in uno stato di peccato.” ++
sudo pacman -S IETF
+ Quest'ultimo è un comando inutile che non funziona+ +
+
+
+ The processing of any packet sent to a loopback address, is implemented in
+ the link layer of the TCP/IP stack. Such packets are never passed to any
+ network interface controller (NIC) or hardware device driver and must not
+ appear outside of a computing system, or be routed by any router. This
+ permits software testing and local services in the absence of any hardware
+ network interfaces.
+ Looped-back packets are distinguished from any other packets traversing
+ the TCP/IP stack only by the special IP address they were addressed to.
+ Thus, the services that ultimately receive them respond according to the
+ specified destination. For example, an HTTP service could route packets
+ addressed to 127.0.0.99:80
and 127.0.0.100:80 to different Web servers, or
+ to a single server that returns different web pages. To simplify such
+ testing, the hosts file may be configured to provide appropriate names for
+ each address.
+
+ Packets received on a non-loopback interface with a loopback source or
+ destination address must be dropped. Such packets are sometimes referred
+ to as Martian packets.[6] As with any other bogus packets, they may be
+ malicious and any problems they might cause can be avoided by applying
+ bogon filtering.
+
+ The releases of the
+ MySQL database
+ differentiate between the use of the hostname localhost and the use of the
+ addresses 127.0.0.1 and ::1.[7] When
qusing localhost as the destination in
+ a client connector interface of an application, the MySQL application
+ programming interface connects to the database using a Unix domain socket,
+ while a TCP connection via the loopback interface requires the direct use
+ of the explicit address.
+ One notable exception to the use of the 127.0.0.0/8 addresses is their use
+ in Multiprotocol Label Switching
(MPLS) traceroute error detection, in
+ which their property of not being routable provides a convenient means to
+ avoid delivery of faulty packets to end users.
+
+ The local loopback mechanism may be used to run a network service on a
+ host without requiring a physical network interface, or without making the
+ service accessible from the networks the computer may be connected to. For
+ example, a locally installed website may be accessed from a Web browser by
+ the URL http://localhost to display its home page. The name localhost
+ normally resolves to the IPv4 loopback address 127.0.0.1, and to the
+ IPv6
+ loopback address ::1.
+
+ “I computer sono incredibilmente veloci, accurati e stupidi. Gli uomini sono incredibilmente lenti,
+ inaccurati e intelligenti. L'insieme dei due costituisce una forza incalcolabile.”
Albert Einstain
+
+ IPv4
+ network
+ standards reserve the entire address block
+ 127.0.0.0/8 (more than 16 million addresses) for loopback purposes.[2]
+ That means any packet sent to any of those addresses is looped back. The
+ address 127.0.0.1 is the standard address for IPv4
+ loopback
+ traffic; the rest are not supported by all operating systems. However,
+ they can be used to set up multiple server applications on the host, all
+ listening on the same port number. The IPv6 standard assigns only a single
+ address for loopback: ::1. The resolution of the name localhost to one or
+ more IP addresses is normally configured by the following lines in the
+ operating system's hosts file:IPv4 network standards reserve the entire
+ address block 127.0.0.0/8 (more than 16 million addresses) for loopback
+ purposes.[2] That means any packet sent
+ to any of those addresses is looped back. The address 127.0.0.1 is the
+ standard address for IPv4 loopback traffic; the rest are not supported by
+ all operating systems. However, they can be used to set up multiple server
+ applications on the host, all listening on the same port number. The IPv6
+ standard assigns only a single address for loopback: ::1. The resolution
+ of the name localhost to one or more IP addresses is normally configured
+ by the following lines in the operating system's hosts file:
+ 127.0.0.1 localhost
+ ::1 localhost
+ 127.0.0.1 localhost
+ ::1 localhost
+
+
+
+ The name may also be resolved by Domain Name System (DNS) servers, but
+ queries for this name should be resolved locally, and should not be
+ forwarded to remote name servers.
+
+ In addition to the mapping of localhost to the loopback addresses
+ (127.0.0.1 and ::1), localhost may also be mapped to other IPv4 (loopback)
+ addresses and it is also possible to assign other, or additional, names to
+ any loopback address. The mapping of localhost to addresses other than the
+ designated loopback address range in the hosts file or in DNS is not
+ guaranteed to have the desired effect, as applications may map the name
+ internally.
+
+ In the Domain Name
+ System, the name localhost is reserved as a top-level domain name, originally
+ set aside to avoid confusion with the hostname used for loopback
+ purposes.[3] IETF standards prohibit domain name registrars from assigning
+ the name localhost.
+
+
+
+ The name localhost is reserved for loopback purposes by RFC 6761
+ (Special-Use Domain Names),[4] which achieved the Proposed Standard
+ maturity level in February 2013. The standard sets forth a number of
+ special considerations governing the use of the name in the Domain Name
+ System:
+
+
+
+ An IPv4 or IPv6 address query for the name localhost must always resolve
+ to the respective loopback address, which is specified in a separate
+ standard. Applications may resolve the name to a loopback address
+ themselves, or pass it to the local name resolver mechanisms. When a name
+ resolver receives an address (A or AAAA) query for localhost, it should
+ return the appropriate loopback addresses, and negative responses for any
+ other requested record types. Queries for localhost should not be sent to
+ caching name servers. To avoid burdening the Domain Name System root
+ servers with traffic, caching name servers should never request name
+ server records for localhost, or forward resolution to authoritative name
+ servers. DNS registrars are precluded from delegating domain names in the
+ top-level domain localhost. When
+ name servers receive queries for
+ 'localhost' in spite of the provisions mentioned resolve them
+ appropriately. The IPv4 loopback addresses are reserved within the IPv4
+ address space by the IETF
"Special Use IPv4 Addresses" standard (RFC
+ 5735).[5] The reservation can be traced back to the November 1986
+ "Assigned Numbers" standard (RFC 990).
+
+ “Chiunque consideri i metodi aritmetici metodi di produrre numeri casuali è, naturalmente, in uno stato di peccato.” ++
sudo pacman -S IETF
+ Quest'ultimo è un comando inutile che non funziona+ +
+
+
+ The processing of any packet sent to a loopback address, is implemented in
+ the link layer of the TCP/IP stack. Such packets are never passed to any
+ network interface controller (NIC) or hardware device driver and must not
+ appear outside of a computing system, or be routed by any router. This
+ permits software testing and local services in the absence of any hardware
+ network interfaces.
+ Looped-back packets are distinguished from any other packets traversing
+ the TCP/IP stack only by the special IP address they were addressed to.
+ Thus, the services that ultimately receive them respond according to the
+ specified destination. For example, an HTTP service could route packets
+ addressed to 127.0.0.99:80
and 127.0.0.100:80 to different Web servers, or
+ to a single server that returns different web pages. To simplify such
+ testing, the hosts file may be configured to provide appropriate names for
+ each address.
+
+ Packets received on a non-loopback interface with a loopback source or
+ destination address must be dropped. Such packets are sometimes referred
+ to as Martian packets.[6] As with any other bogus packets, they may be
+ malicious and any problems they might cause can be avoided by applying
+ bogon filtering.
+
+ The releases of the
+ MySQL database
+ differentiate between the use of the hostname localhost and the use of the
+ addresses 127.0.0.1 and ::1.[7] When
qusing localhost as the destination in
+ a client connector interface of an application, the MySQL application
+ programming interface connects to the database using a Unix domain socket,
+ while a TCP connection via the loopback interface requires the direct use
+ of the explicit address.
+ One notable exception to the use of the 127.0.0.0/8 addresses is their use
+ in Multiprotocol Label Switching
(MPLS) traceroute error detection, in
+ which their property of not being routable provides a convenient means to
+ avoid delivery of faulty packets to end users.
+
+ The local loopback mechanism may be used to run a network service on a
+ host without requiring a physical network interface, or without making the
+ service accessible from the networks the computer may be connected to. For
+ example, a locally installed website may be accessed from a Web browser by
+ the URL http://localhost to display its home page. The name localhost
+ normally resolves to the IPv4 loopback address 127.0.0.1, and to the
+ IPv6
+ loopback address ::1.
+
+ “I computer sono incredibilmente veloci, accurati e stupidi. Gli uomini sono incredibilmente lenti,
+ inaccurati e intelligenti. L'insieme dei due costituisce una forza incalcolabile.”
Albert Einstain
+
+ IPv4
+ network
+ standards reserve the entire address block
+ 127.0.0.0/8 (more than 16 million addresses) for loopback purposes.[2]
+ That means any packet sent to any of those addresses is looped back. The
+ address 127.0.0.1 is the standard address for IPv4
+ loopback
+ traffic; the rest are not supported by all operating systems. However,
+ they can be used to set up multiple server applications on the host, all
+ listening on the same port number. The IPv6 standard assigns only a single
+ address for loopback: ::1. The resolution of the name localhost to one or
+ more IP addresses is normally configured by the following lines in the
+ operating system's hosts file:IPv4 network standards reserve the entire
+ address block 127.0.0.0/8 (more than 16 million addresses) for loopback
+ purposes.[2] That means any packet sent
+ to any of those addresses is looped back. The address 127.0.0.1 is the
+ standard address for IPv4 loopback traffic; the rest are not supported by
+ all operating systems. However, they can be used to set up multiple server
+ applications on the host, all listening on the same port number. The IPv6
+ standard assigns only a single address for loopback: ::1. The resolution
+ of the name localhost to one or more IP addresses is normally configured
+ by the following lines in the operating system's hosts file:
+ 127.0.0.1 localhost
+ ::1 localhost
+ 127.0.0.1 localhost
+ ::1 localhost
+
+
+
+ The name may also be resolved by Domain Name System (DNS) servers, but
+ queries for this name should be resolved locally, and should not be
+ forwarded to remote name servers.
+
+ In addition to the mapping of localhost to the loopback addresses
+ (127.0.0.1 and ::1), localhost may also be mapped to other IPv4 (loopback)
+ addresses and it is also possible to assign other, or additional, names to
+ any loopback address. The mapping of localhost to addresses other than the
+ designated loopback address range in the hosts file or in DNS is not
+ guaranteed to have the desired effect, as applications may map the name
+ internally.
+
+ In the Domain Name
+ System, the name localhost is reserved as a top-level domain name, originally
+ set aside to avoid confusion with the hostname used for loopback
+ purposes.[3] IETF standards prohibit domain name registrars from assigning
+ the name localhost.
+
+
+
+ The name localhost is reserved for loopback purposes by RFC 6761
+ (Special-Use Domain Names),[4] which achieved the Proposed Standard
+ maturity level in February 2013. The standard sets forth a number of
+ special considerations governing the use of the name in the Domain Name
+ System:
+
+
+
+ An IPv4 or IPv6 address query for the name localhost must always resolve
+ to the respective loopback address, which is specified in a separate
+ standard. Applications may resolve the name to a loopback address
+ themselves, or pass it to the local name resolver mechanisms. When a name
+ resolver receives an address (A or AAAA) query for localhost, it should
+ return the appropriate loopback addresses, and negative responses for any
+ other requested record types. Queries for localhost should not be sent to
+ caching name servers. To avoid burdening the Domain Name System root
+ servers with traffic, caching name servers should never request name
+ server records for localhost, or forward resolution to authoritative name
+ servers. DNS registrars are precluded from delegating domain names in the
+ top-level domain localhost. When
+ name servers receive queries for
+ 'localhost' in spite of the provisions mentioned resolve them
+ appropriately. The IPv4 loopback addresses are reserved within the IPv4
+ address space by the IETF
"Special Use IPv4 Addresses" standard (RFC
+ 5735).[5] The reservation can be traced back to the November 1986
+ "Assigned Numbers" standard (RFC 990).
+
+ “Chiunque consideri i metodi aritmetici metodi di produrre numeri casuali è, naturalmente, in uno stato di peccato.” ++
sudo pacman -S IETF
+ Quest'ultimo è un comando inutile che non funziona+ +
+
+
+ The processing of any packet sent to a loopback address, is implemented in
+ the link layer of the TCP/IP stack. Such packets are never passed to any
+ network interface controller (NIC) or hardware device driver and must not
+ appear outside of a computing system, or be routed by any router. This
+ permits software testing and local services in the absence of any hardware
+ network interfaces.
+ Looped-back packets are distinguished from any other packets traversing
+ the TCP/IP stack only by the special IP address they were addressed to.
+ Thus, the services that ultimately receive them respond according to the
+ specified destination. For example, an HTTP service could route packets
+ addressed to 127.0.0.99:80
and 127.0.0.100:80 to different Web servers, or
+ to a single server that returns different web pages. To simplify such
+ testing, the hosts file may be configured to provide appropriate names for
+ each address.
+
+ Packets received on a non-loopback interface with a loopback source or
+ destination address must be dropped. Such packets are sometimes referred
+ to as Martian packets.[6] As with any other bogus packets, they may be
+ malicious and any problems they might cause can be avoided by applying
+ bogon filtering.
+
+ The releases of the
+ MySQL database
+ differentiate between the use of the hostname localhost and the use of the
+ addresses 127.0.0.1 and ::1.[7] When
qusing localhost as the destination in
+ a client connector interface of an application, the MySQL application
+ programming interface connects to the database using a Unix domain socket,
+ while a TCP connection via the loopback interface requires the direct use
+ of the explicit address.
+ One notable exception to the use of the 127.0.0.0/8 addresses is their use
+ in Multiprotocol Label Switching
(MPLS) traceroute error detection, in
+ which their property of not being routable provides a convenient means to
+ avoid delivery of faulty packets to end users.
+
One
+The two boxes should float to either side of this text
+Two
+Cause this sentence to appear below the float.
+
+
+ Tux 1 + |
+
+
+ Tux 2 + |
+
+
+ Tux 3 + |
+
+
+ Tux 4 + |
+
+
+ Tux 5 + |
+
+ TUX 1
+
+ TUX 2
+
+ TUX 3
+
+ TUX 4
+
+ TUX 5
+
- Ho sempre sognato di saper programmare e smanettare con il computer però
- non sapevo da dove iniziare e avevo paura di rompere qualcosa, inoltre
- il mondo delle connesioni internet, di questa "magia" mi ha sempre
- incuriosito.
Così ho trovato l'indirizzo perfetto per me e sotto
- consiglio ho scelto questo istituto.
- Ho atteso fino alla terza superiore, quindi al primo anno di indirizzo
- informatica e telecomunicazioni, per iniziare a documentarmi in
- autonomia, e con l'aiuto dei professori sto apprendendo i principi e gli
- approfondimenti delle loro materie.
-
- Durante le prime settimane del terzo anno il professore, di tpsi e
- sistemi e reti,
- Mancuso
- ci ha spiegato, brevemente, che cos'è linux e lo abbiamo inizialmente
- utilizzato sui computer della scuola.
- nei giorni dopo la sua lezione mi sono documentato sulla storia di
- Linus Torvalds
- e ne sono rimasto affascinato! Le sue parole:"Sto facendo un sistema operativo (libero), (solo un passatempo, non
- sarà né grosso né professionale come gnu)".
-
Lui ha attuato perfettamente la filosofia dell'open source.
-
- Prima della mia esperienza bisogna capire come funziona Linux.
- Linux in se è il kernel, la distribuzione utilizza il kernel per
- funzionare.
- Io ho iniziato con una distribuzione user friendly:
- Zorin OS
- basata su ubuntu, semplice per i nuovi utenti.
- Poi sono passato ad
- Artix Linux basato
- su Arch, molto più complesso già dall'installazione, ma questa
- complessità mi ha permesso di imparare come funziona ogni sistema
- operativo, cos'è una
-
- Desktop Environment
- come installarla e quali esistono, che cos'è un
- File System
- e come funziona il file system di Linux, cos'è un
- Package Manager
- e che comandi utilizza quello di Arch, ovvero Pacman. Insomma, Linux mi
- ha aperto un vero e proprio nuovo mondo.
-
- Ho installato un'intelligenza artificiale in locale, quindi che sfrutta
- la memoria RAM, la GPU o CPU nel caso sia molto potente come il modello
- di gpt-oss.
- Ho utilizzato un "tramite" che si chiama
- Ollama, con comandi
- tramite terminale come:
-
- ''''
- bash
-
- ollama serve # Per avviare il servizio, deve rimanere avviato: funzionerà come log.
- ollama run "nome del servizio come gpt-oss" # Per avviare l'AI. (Questo in una finestra di terminale diverso rispetto al comando precedente)
-
- ''''
- Ecco un esempio di output dell'AI di gpt-oss:
-
-
- Come si può notare, gpt-oss ci mostra anche come pensa l'AI prima di
- dare una risposta.
- Ovviamente gpt-oss è un modello molto pesante, esistono anche modelli
- più leggeri nella pagina
- models del loro
- sito.
-
| Caratteristiche | -ChatGPT | -GPT-OSS(locale) | -
|---|---|---|
| Dove gira | -Cloud OpenAI | -Sul tuo PC | -
| Privacy | -Dati ai server | -Dati solo locali | -
| Facilità | -Molto facile | -Richiede setup | -
| Costo | -Gratis/abbonamento | -Gratis | -
| Prestazioni | -Sempre ottimale | -Dipende dal tuo hardware | -
| Personalizzazione | -Limitata | -Massima (modificabile) | -
| Connessione | -Necessaria | -Può funzionare offline | -
Questo è il mio sito portfolio. Per ora solo in HTML e CSS sentiti libro di esplorarlo.
+ + \ No newline at end of file diff --git a/TPSI/costanzo_francesco/sito_portfolio/pcto.html b/TPSI/costanzo_francesco/sito_portfolio/pcto.html deleted file mode 100644 index fcf376e3..00000000 --- a/TPSI/costanzo_francesco/sito_portfolio/pcto.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/TPSI/costanzo_francesco/sito_portfolio/progetti.html b/TPSI/costanzo_francesco/sito_portfolio/progetti.html index 51f75d07..a8a4b7c0 100644 --- a/TPSI/costanzo_francesco/sito_portfolio/progetti.html +++ b/TPSI/costanzo_francesco/sito_portfolio/progetti.html @@ -4,6 +4,122 @@ + +Antico algoritmo di cifratura, il Cifrario di Cesare, questo codice in C permette di decifrare e cifrare un messaggio.
+
+ Codice in C:
+
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+
+ //costanti importanti
+ const int LETTEREALFABETO = 21;
+ const char ALFABETO[] = {'a','b','c','d','e','f','g','h','i',
+ 'l','m','n','o','p','q','r','s','t',
+ 'u','v','z'};
+ const int MAXCARATTERI = 20;
+
+ //main
+ int main(int argc, char **argv) {
+
+ //"trasformazione" da string in int
+ int k = atoi(argv[1]);
+
+ char parola[MAXCARATTERI + 1];
+ strncpy(parola, argv[2], MAXCARATTERI);
+
+ //Stampa del "menu"
+ printf("Input: %s\n", parola);
+ printf("Chiave: %d", k);
+
+ //cicli for per scorrere lettere e sostituire
+ for (int i = 0; parola[i] != '\0'; i++) {
+
+ for (int j = 0; j < LETTEREALFABETO; j++) {
+ if (parola[i] == ALFABETO[j]) {
+ int nuova_pos = (j - k + LETTEREALFABETO) % LETTEREALFABETO;
+
+ parola[i] = ALFABETO[nuova_pos];
+ break;
+ }
+ }
+
+ }
+ //stampa risulitato
+ printf("\nRisultato: %s\n", parola);
+ return 0;
+ }
+
+
+ Algoritmo che consente di controllare se l'arrivo di bit in una stringa sono corretti o errati, in base al bit di parità o disparità posto al capolinea della stessa.
+
+ Codice in C:
+
+ #include <stdio.h>
+ #include <string.h>
+ #include <stdlib.h>
+
+ bool controllo(int nCaratteri, char codice[]) {
+
+ int temp, somma = 0, cifraControllo;
+ cifraControllo = (int)codice[nCaratteri - 1] - 48;
+
+ for (int i = 0; i < nCaratteri; i++) {
+ if (i != nCaratteri) {
+ temp = (int)(codice[i] - 48);
+ somma += temp;
+ }
+ }
+
+ return (somma % 2) == cifraControllo;
+ }
+
+ bool main (int argc, char *argv[]) {
+
+ int nCaratteri = strlen(argv[1]);
+ char codice[nCaratteri + 1];
+ bool flag;
+ strcpy(codice, argv[1]);
+ if (*argv[2] == '0') {
+ flag = controllo(nCaratteri, codice);
+ } else if(*argv[2] == '1') {
+ flag = !controllo(nCaratteri, codice);
+ }
+
+ printf("\nIl flag è: %d", flag);
+
+ return flag;
+ }
+
+
+ Sviluppo di calcolatore di codice fiscale.