Untitled

Run Settings
LanguageC++
Language Version
Run Command
#include <iostream> #include <cmath> #include <ctime> using namespace std; void test(int a[19], int b[26]) { int maxa = 0, coora; for (int i = 0; i < 19; ++i) { if (a[i] > maxa) { maxa = a[i]; coora = i; } } int maxb = 0, coorb; for (int i = 0; i < 26; ++i) { if (b[i] > maxb) { maxb = b[i]; coorb = i; } } cout << maxa << "\t" << maxb << endl; a[coora] = maxa; b[coorb] = maxb; } int main() { srand(time(NULL)); int a[19]{}; int b[26]; for (int i = 0; i < 26; i++) { b[i] = rand() % 100; cout << b[i] << "\t"; } cout << endl << "INPUT A DIGIT"<<endl; for (int i = 0; i < 19; i++) { cin >> a[i]; } test(a,b); system("PAUSE"); system("cls"); for (int i = 0; i < 26; i++) { cout << b[i] << "\t"; } cout << endl; for (int i = 0; i < 19; i++) { cout << a[i] << "\t"; } system("PAUSE"); return 0; }
Editor Settings
Theme
Key bindings
Full width
Lines