diff options
| author | Santo Cariotti <sancn@live.com> | 2017-04-25 17:17:24 +0200 | 
|---|---|---|
| committer | Santo Cariotti <sancn@live.com> | 2017-04-25 17:17:24 +0200 | 
| commit | bca44eed99ddc009f6fc172f2654ba7ae6088598 (patch) | |
| tree | 18edc25c21c5b7d30729be96104ecef235637657 /vettpari.cc | |
| parent | ed657ff62905f4b0b95e6b9c7f083596dcec416a (diff) | |
Deleted old files
Diffstat (limited to 'vettpari.cc')
| -rw-r--r-- | vettpari.cc | 52 | 
1 files changed, 0 insertions, 52 deletions
| diff --git a/vettpari.cc b/vettpari.cc deleted file mode 100644 index e82cf23..0000000 --- a/vettpari.cc +++ /dev/null @@ -1,52 +0,0 @@ -/* realizzare un programma in grado di caricare un vettore di dimensione 10 -con dei numeri interi divisibili per il numero 2 -utilizzato compilatore GCC 5.0.2 */ -#include <iostream> - -using namespace std; - -bool pari(int n); - -int main(int argc, char *argv[]) -{ -  int N, num, i, totale = 0; -  while(true) -  { -    cout << "Inserisci lunghezza vettore: "; -    cin >> N; -    if(N < 1) -      cout << "Lunghezza vettore con consentita." << endl; -    else -      break; -  } -   -  int vett[N]; - -  for(i = 0; i < N; i++) -  { -    while(true) -    { -      cout << "Inserisci un numero pari: "; -      cin >> num; -      if(pari(num) == true){ -      vett[i] = num; -      break; -      }else cout << "Non hai inserito un numero pari, riprova!" << endl; -    } -    totale += num; -  } - -  cout << "----------" << endl; -  for(i = 0; i < N; i++) cout << "vett[" << i << "] = " << vett[i] << endl; -  cout << "----------" << endl; -  cout << "La somma dei valori dell'array e': " << totale << endl; -  cout << "----------" << endl; -  cout << "La media dei valori dell'array e': " << totale / N << endl; - -  return 0; -} - -bool pari(int n) -{ -  return ((n % 2) == 0) ? true : false; -} | 
