| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
i have a littel problem with my program
i need to make progrem that will enter numbers positive (min 4 numbers) and to finish the progrem in the end need to writh -1 the progrem will take and find 4 numbers wich sum is the biggest
there can be min 4 numbers aand -1 in the end
2 4 6 7 33 44 1 -1
so the biggest sum will be
6 7 33 44
please help me |
|
#2
|
|||
|
|||
|
o.k up to now i menage to do this:
#include <iostream.h> void main () { int sum=0, counter, num, n=0; cin >> num; do { counter = n; do { sum = sum + num; counter ++; cin >> num; } while (counter <=n+3 && num != -1) ; cout <<"the sum is:"<<sum<<endl; n= n+1; } while (counter <=n+3); } |
![]() |
| Viewing: Dev Articles Community Forums > Programming > C/C++ Help > C++ loop help |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|