1、
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
struct node{
float pre;
int next;
long long val;
}a[6];
int main(){
string s1[6];
cout<<"Input the data of 5 patients :"<<endl;
for(int i = 1;i<=5;i++){
cin>>s1[i];
}
for(int i=1;i<=5;i++){
float k = 0;
int j = 0;
while(s1[i][j] != '.'){
k = k*10+s1[i][j]-'0';
j++;
}
j++;
int cifang = 1;
while(s1[i][j] != 'e'){
k = k + (float (s1[i][j]- '0'))/pow(10,cifang);
cifang++;
j++;
}
a[i].pre = k;
// s1[i][j] == 'e' 123.23e10
j++;
int next = 0;
while(j<s1[i].size()){
next = next*10+s1[i][j]-'0';
j++;
}
a[i].next = next;
a[i].val = a[i].pre * pow(10,a[i].next);
}
for(int i=1;i<5;i++){
for(int j=i+1;j<=5;j++){
if(a[i].val < a[j].val){
swap(a[i],a[j]);
}
}
}
cout<<"The risk of covid-19 transmission from high to low is as following :"<<endl;
for(int i=1;i<=5;i++){
if(a[i].next <10){
cout<<a[i].pre<<"e+00"<<a[i].next<<endl;
}else if(a[i].next <100){
cout<<a[i].pre<<"e+0"<<a[i].next<<endl;
}else{
cout<<a[i].pre<<"e+"<<a[i].next<<endl;
}
}
}