problemscpp
A collection of my answers to algorithm problems in c++.
静态 Public 成员函数 | 所有成员列表
acwing::acwing661类 参考

AcWing 661. 平均数3 更多...

#include <acwing.h>

静态 Public 成员函数

static int main (istream &cin, ostream &cout)
 

详细描述

AcWing 661. 平均数3

在文件 acwing.h535 行定义.

成员函数说明

◆ main()

int acwing::acwing661::main ( istream &  cin,
ostream &  cout 
)
static

在文件 acwing.cpp1551 行定义.

1551 {
1552 double n1;
1553 double n2;
1554 double n3;
1555 double n4;
1556 cin >> n1 >> n2 >> n3 >> n4;
1557 const double x = (2 * n1 + 3 * n2 + 4 * n3 + n4) / 10;
1558 cout << setiosflags(ios::fixed) << setprecision(1);
1559 cout << "Media: " << x << endl;
1560 if(x >= 7.0) {
1561 cout << "Aluno aprovado.";
1562 } else if(x <= 5.0) {
1563 cout << "Aluno reprovado.";
1564 } else {
1565 cout << "Aluno em exame." << endl;
1566 double y;
1567 cin >> y;
1568 cout << "Nota do exame: " << y << endl;
1569 const double z = (x + y) / 2;
1570 if(z >= 5.0) {
1571 cout << "Aluno aprovado." << endl;
1572 } else {
1573 cout << "Aluno reprovado." << endl;
1574 }
1575 cout << "Media final: " << z;
1576 }
1577 return 0;
1578 }

被这些函数引用 acwing::TEST().


该类的文档由以下文件生成: