结构体
2024-01-30 21:09:59
发布于:广东
到底是 学习讨论 还是 灌水池塘 ?
我不知道!!!!!!!!!!!!!!!! 不要问我!
极简代码,不喜勿喷!
自创代码(不喜勿喷!)
#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
struct Student{
string name;
int id;
double weight,height,Chinese,maths,English,sum,pinjun;
}s[10010];
void Error()
{
cout<<"错误 :)Windows.exe已停止工作" <<endl;
Sleep(1000);
cout<<"Windows安全中心:我们遇到了无法解决的问题"<<endl;
Sleep(500);
cout<<"正在尝试修复……"<<endl;
Sleep(3000);
cout<<"修复失败。建议您关机或重启……"<<endl;
for(int i=1;i<=5;i++)
{
cout<<"Warning! computer failure!(警告!计算机故障!)"<<endl;
Sleep(500);
}
cout<<"电脑强制关机,倒数:"<<endl;
Sleep(1000);
cout<<"3"<<endl;
Sleep(1000);
cout<<"2"<<endl;
Sleep(1000);
cout<<"1"<<endl;
Sleep(1000);
cout<<"正在关机 ……"<<endl;
for(int i=10;i<=100;i+=10)
{
if(i == 100)
{
cout<<"loading 100% 加载完成!";
cout<<"正在注销……"<<endl;
Sleep(1500);
cout<<"关机……";
}
else
{
cout<<"loading……"<<i<<"%";
cout<<"(加载……"<<i<<"%)"<<endl;
Sleep(1000);
}
}
}
int main()
{
string str;
int n;
double o = 0;
double classsum,classpingjun;
for(int i=1;i<=3;i++)
{
cout<<"所有在下列中输入不规范的变量及字符(串)都会遭到最严厉的惩罚?"<<endl;
}
cout<<"(重要的事情说三遍,注意看句子后面是问号,建议勇者尝试)"<<endl;
cout<<endl;
cout<<"创建一个班级 ——输入验证码 a 即可开始"<<endl;
cin>>str;
if(str != "abc")
{
Error();
return 0;
}
cout<<"请输入学生总数 (不超过10000,可以等于):"<<endl;
cin>>n;
if(n > 10000)
{
Error();
return 0;
}
for(int i=1;i<=n;i++)
{
cout<<"请输入第"<<i<<"个学生的信息"<<endl;
cout<<"(string-姓名、int-学号、double-体重、double-身高、"<<endl;
cout<<"double-语文成绩、double-数学成绩、double-英语成绩)"<<endl;
cout<<"按顺序依次输入:"<<endl;
cout<<endl;
cin>>s[i].name>>s[i].weight>>s[i].height>>s[i].Chinese>>s[i].maths>>s[i].English;
s[i].sum = s[i].Chinese + s[i].maths + s[i].English;
s[i].pinjun = s[i].sum / 3;
classsum += s[i].sum;
cout<<endl;
}
classpingjun = classsum / n;
for(int i=1;i<=n;i++)
{
cout<<s[i].name<<"的三科总分是:"<<s[i].sum<<"分"<<endl;
cout<<" 离总分300差了"<<300 - s[i].sum<<"分"<<endl;
cout<<s[i].name<<"的三科平均分是:"<<s[i].pinjun<<"分"<<endl;
cout<<" 离(满分)平均分100差了"<<100 - s[i].pinjun<<"分"<<endl;
}
cout<<"全班的总分是:"<<classsum<<"分"<<endl;
cout<<" 离(满分)全班总分"<<n*300<<"差了"<<n*300 - classsum<<"分"<<endl;
cout<<"全班的平均分是:"<<classsum<<"分"<<endl;
cout<<" 离(满分)全班平均分"<<n*100<<"差了"<<n*100 - classpingjun<<"分"<<endl;
return 0;
}
这里空空如也
有帮助,赞一个