Upload files to "verifica_1"
This commit is contained in:
parent
9167e9ca6e
commit
7fc7cd8f3a
|
@ -0,0 +1,29 @@
|
||||||
|
/*
|
||||||
|
AUTORE: Manuel Vichi 3^AIN
|
||||||
|
Esercizio 1
|
||||||
|
*/
|
||||||
|
#include <iostream>
|
||||||
|
using namespace std;
|
||||||
|
int main(void) {
|
||||||
|
int valore;
|
||||||
|
bool accettato = false;
|
||||||
|
while (accettato == false) {
|
||||||
|
cout << "Inserisci un valore: ";
|
||||||
|
cin >> valore;
|
||||||
|
cout << endl;
|
||||||
|
if (valore > -11 && valore < 11) {
|
||||||
|
cout << "Valore accettato" << endl;
|
||||||
|
accettato = true;
|
||||||
|
} else {
|
||||||
|
if (valore < -20 || valore > 20) {
|
||||||
|
cout << "Valore accettato" << endl;
|
||||||
|
accettato = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
cout << "ERRORE! Valore non valido!" << endl;
|
||||||
|
accettato = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
/*
|
||||||
|
AUTORE: Manuel Vichi 3^AIN
|
||||||
|
Esercizio 2
|
||||||
|
*/
|
||||||
|
#include <iostream>
|
||||||
|
using namespace std;
|
||||||
|
int main(void) {
|
||||||
|
int giorni = 0;
|
||||||
|
int cioccolato = 20;
|
||||||
|
do {
|
||||||
|
//cout << "Giorno: " << giorni << endl << "Cioccolato: " << cioccolato << endl;
|
||||||
|
cioccolato = cioccolato + 0.1 * cioccolato;
|
||||||
|
giorni++;
|
||||||
|
} while (cioccolato <= 1000);
|
||||||
|
cout << "I giorni necessari affinche' il consumo di cioccolato superi i 1000 g sono: " << giorni << endl;
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
/*
|
||||||
|
AUTORE: Manuel Vichi
|
||||||
|
|
||||||
|
*/
|
||||||
|
#include <iostream>
|
||||||
|
using namespace std;
|
||||||
|
int main(void) {
|
||||||
|
unsigned int numero, esponente, potenza = 0, moltiplicazione = 0;
|
||||||
|
cout << "Inserisci un numero: ";
|
||||||
|
cin >> numero;
|
||||||
|
cout << endl;
|
||||||
|
cout << "Inserisci un esponente per la potenza di 2: ";
|
||||||
|
cin >> esponente;
|
||||||
|
cout << endl;
|
||||||
|
// Moltiplicazione: Calcolo della potenza
|
||||||
|
for (int temp = 0; temp < esponente; temp++) {
|
||||||
|
potenza = potenza + esponente;
|
||||||
|
}
|
||||||
|
for (int temp = 0; temp < potenza; temp++) {
|
||||||
|
moltiplicazione = moltiplicazione + numero;
|
||||||
|
}
|
||||||
|
cout << "Risultato Moltiplicazione: " << moltiplicazione << endl;
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue