Untitled

Run Settings
LanguageC++
Language Version
Run Command
#include <iostream> using namespace std; void max(int a[] , int size){ int max = 0 ; for (size_t i = 0 ; i < size ; i++){ if (a[i] > max){ max = a[i]; } } for (size_t i = 0 ; i < size ; i++){ if (a[i] > 0 ) { a[i] = max; } } for (size_t i = 0 ; i < size ; i++){ cout << a[i] << endl ; } } int main() { int a[19] , b[26] = { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 , 19 , -1 , -1 , -2 , 13 , 14 ,25 , 26}; for (size_t i = 0 ; i < 19 ; i++){ cin >> a[i] ; } max(a,19); cout << endl << endl ; max (b,26); return 0; }
Editor Settings
Theme
Key bindings
Full width
Lines