#includeusing namespace std;void process(float a[],int n) { float min,
#include<iostream>usingnamespacestd;voidprocess(floata[],intn){floatmin,max;inti=0;for(i=0,max=min=a[0];i<n;i++){if(min>a[i])min=a[i];if(max<a[i])max=a[i];}cout<<"min="<<min;cout<<",max="<<max<<"";}voidprint(floata[],intn){for(inti=0;i<n;i++){if(i%6==0)cout<<"";cout<<a[i]<<"";}}voidmain(){floata[24]={2,1,4,45,23,33,-7,8,5,9,0,-4,66,12,55,33,32,11,63,14,88,-9,23,6};print(a,24);process(a,24);}
#include <iostream>using namespace std;void process(float arr[], int len){ float temp; for(int i = 0; i < len - 1; ++i) { for(int j = 0; j < len - i - 1; ++j) { if(arr[j] > arr[j+1]) { temp = arr[j]; arr[j] = arr[j+1]; arr[j+1] = temp; } } } cout << "最小元素为 : " << arr[0] << endl; cout << "最大元素为 : " << arr[len-1] << endl;}void print(float arr[], int len){ int i = 0; while(i != len) { cout << arr[i] << " "; if( (i+1) % 6 == 0) cout << endl; ++i; }}int main(){ float a[24]={2,1,4,45,23,33,-7,8,5,9,0,-4,66,12,55,33,32,11,63,14,88,-9,23,6}; process(a, 24); print(a, 24); return 0;}
#include<iostream>using namespace std;void process(float a[],int n) { float min,max; int i=0; for(i=0,max=min=a[0];i<n;i++){ if(min>a[i])min=a[i]; if(max<a[i])max=a[i]; }cout<<"\nmin="<<min; cout<<",max="<<max<<"\n";}void print(float a[],int n){ for(int i= 0;i<n;i++) { if(i%6==0)cout<<"\n"; cout<<a[i]<<"\t"; }} void main() { float a[24]={2,1,4,45,23,33,-7,8,5,9,0,-4,66,12,55,33,32,11,63,14,88,-9,23,6}; print(a,24);process(a,24) ;}本回答被提问者采纳
最多设置5个标签!
#include<iostream>
using
namespace
std;
void
process(float
a[],int
n)
{
float
min,max;
int
i=0;
for(i=0,max=min=a[0];i<n;i++){
if(min>a[i])min=a[i];
if(max<a[i])max=a[i];
}
cout<<"
min="<<min;
cout<<",max="<<max<<"
";
}
void
print(float
a[],int
n)
{
for(int
i=
0;i<n;i++)
{
if(i%6==0)cout<<"
";
cout<<a[i]<<"
";
}
}
void
main()
{
float
a[24]={2,1,4,45,23,33,-7,8,5,9,0,-4,66,12,55,33,32,11,63,14,88,-9,23,6};
print(a,24);
process(a,24)
;
}
#include <iostream>
using namespace std;
void process(float arr[], int len)
{
float temp;
for(int i = 0; i < len - 1; ++i)
{
for(int j = 0; j < len - i - 1; ++j)
{
if(arr[j] > arr[j+1])
{
temp = arr[j];
arr[j] = arr[j+1];
arr[j+1] = temp;
}
}
}
cout << "最小元素为 : " << arr[0] << endl;
cout << "最大元素为 : " << arr[len-1] << endl;
}
void print(float arr[], int len)
{
int i = 0;
while(i != len)
{
cout << arr[i] << " ";
if( (i+1) % 6 == 0) cout << endl;
++i;
}
}
int main()
{
float a[24]={2,1,4,45,23,33,-7,8,5,9,0,-4,66,12,55,33,32,11,63,14,88,-9,23,6};
process(a, 24);
print(a, 24);
return 0;
}
#include<iostream>
using namespace std;
void process(float a[],int n) {
float min,max;
int i=0;
for(i=0,max=min=a[0];i<n;i++){
if(min>a[i])min=a[i];
if(max<a[i])max=a[i];
}
cout<<"\nmin="<<min;
cout<<",max="<<max<<"\n";
}
void print(float a[],int n)
{
for(int i= 0;i<n;i++) {
if(i%6==0)cout<<"\n";
cout<<a[i]<<"\t";
}
}
void main()
{
float a[24]={2,1,4,45,23,33,-7,8,5,9,0,-4,66,12,55,33,32,11,63,14,88,-9,23,6};
print(a,24);
process(a,24) ;
}本回答被提问者采纳