1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
#include<iostream>
#include<cstdlib>
using namespace std;
int somme(int som)
{
int nb,d;
// int som=0;
cout << "entrer une entier" << endl;
cin>>nb;
som=som+nb;
// fait doublon avec main ()
// cout << "la somme est " << som << endl;
cin >> d; // Je n'en vois pas l'intérêt. Faire une pause ?
return som;
}
int main()
{
int nb,t;
int n;
int cpt=1;
int som = 0;
cout << "entrer d'entiers coulez vous entrer ? " << endl;
cin >> n;
// On ne fait rien de nb pas la suite.
// cout << "enter un entier " << endl;
// cin >> nb;
while(cpt<n)
{ cpt=cpt+1;
// Inutile
// cout << "entrer un autre entier " << endl;
// cin >> nb;
som = somme (som);
cout << "la somme est "<< som << endl;
}
return EXIT_SUCCESS;
} |
Partager