Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
ExtremeValues
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
//g++ 7.4.0 //write and test a function that returns through its reference parameters both the maximum and minimum values stored in an array //this code is created by Rezaul Hoque on August 10,2021;contact: jewelmrh@yahoo.com //note: codes shared by Rezaul Hoque on rextester are not for sale; they are created and shared to facilitate the algorithm learning process; many like Hoque use this platform to practice programming ;Rezaul hopes his contribution helps others to fine tune their learning; #include <iostream> using namespace std; const int n=10; void extremes(int &,int &,int [],int); void extremes(int& min,int& max,int a[],int n){ min = a[0]; for(int i=0;i<n;i++) if(a[i]<min) min=a[i]; max = a[0]; for(int i=0;i<n;i++) if(a[i]>max) max=a[i]; cout<<"minimum value: "<<min<<endl; cout<<"maximum value: "<<max<<endl; } int main() { int a[]={10,9,5,8,30,26,32,1,78,20}; int min,max; extremes(min, max,a,10); return 0; }
g++
Show compiler warnings
[
+
] Compiler args
[
+
]
Show input
Compilation time: 0.75 sec, absolute running time: 0.19 sec, cpu time: 0 sec, memory peak: 5 Mb, absolute service time: 1,03 sec
edit mode
|
history
|
discussion
minimum value: 1 maximum value: 78