16-3cout<<(double)...写法
#include<iostream>
using namespace std;
int n,m;
const int N=10;
struct student
{
int id;
int a;
int b;
int c;
}s[N];
int main()
{
cin>>n>>m;
for(int i=0;i<n;i++)
{
cin>>s[i].id>>s[i].a>>s[i].b>>s[i].c;
}
for(int i=0;i<n;i++)
{
cout<<"学号:"<<s[i].id<<endl;
cout<<"总课时:"<<m<<endl;
cout<<"正常:"<<s[i].a<<endl;
cout<<"迟到:"<<s[i].b<<endl;
cout<<"旷课:"<<s[i].c<<endl;
cout<<"出勤率:" << (double) (s[i].a + s[i].b) / m<<endl; // 计算上课率
cout<<"旷课率:" << (double) s[i].c/ m<<endl; // 计算上课率
}
return 0;
}