summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSanto Cariotti <sancn@live.com>2017-04-25 17:09:46 +0200
committerSanto Cariotti <sancn@live.com>2017-04-25 17:09:46 +0200
commited657ff62905f4b0b95e6b9c7f083596dcec416a (patch)
tree4551647d6abac0eb54e93237e9862b5ee8b196d6
parenteb1dc5ad36ca3be532c1210ca10a4882fafb732a (diff)
Renamed grafo.cpp and fix mmAcqua.cc with a switch case
-rw-r--r--grafo.cpp (renamed from main.cpp)0
-rw-r--r--mmAcqua.cc21
2 files changed, 11 insertions, 10 deletions
diff --git a/main.cpp b/grafo.cpp
index 911d7e6..911d7e6 100644
--- a/main.cpp
+++ b/grafo.cpp
diff --git a/mmAcqua.cc b/mmAcqua.cc
index 1bcd882..7c89cdb 100644
--- a/mmAcqua.cc
+++ b/mmAcqua.cc
@@ -9,7 +9,7 @@ void giorniSettimana(int a);
int main()
{
- float mmAcquaSettimana[7], media;
+ float mmAcquaSettimana[7], media = 0;
int i;
cout << "INSERIRE QUANTI MM DI PIOGGIA SONO CADUTI IN UNA SETTIMANA (0 E' NULLA)\n" << endl;
@@ -25,7 +25,7 @@ int main()
cout << "\n";
cout << "I giorni piovosi sono stati: ";
for(i = 0; i < 7; i++) {
- if(mmAcquaSettimana[i] > 0.0) {
+ if(mmAcquaSettimana[i] > 0) {
giorniSettimana(i);
cout << " - ";
}
@@ -39,12 +39,13 @@ int main()
void giorniSettimana(int a)
{
- if(a == 0) cout << "Lunedi'";
- else if(a == 1) cout << "Martedi'";
- else if(a == 2) cout << "Mercoledi'";
- else if(a == 3) cout << "Giovedi'";
- else if(a == 4) cout << "Venerdi'";
- else if(a == 5) cout << "Sabato";
- else cout << "Domenica";
-
+ switch(a) {
+ case 0: cout << "Lunedi'"; break;
+ case 1: cout << "Martedi'"; break;
+ case 2: cout << "Mercoledi'"; break;
+ case 3: cout << "Giovedi'"; break;
+ case 4: cout << "Venerdi'"; break;
+ case 5: cout << "Sabato"; break;
+ default: cout << "Domenica";
+ }
}