竞选班长#C++

题目描述

竞选班长的条件是:语文、数学、英语三门成绩中,至少两门大于或等于 90 分,而且思想品德不能低于 85 分。给定小爱的语文、数学、英语和思想品德成绩,请问她能否竞选班长?

输入

第一行:单个整数 a ,表示语文成绩;
第二行:单个整数 b,表示数学成绩;
第三行:单个整数 c,表示英语成绩;
第四行:单个整数 d,表示思想品德成绩。

输出

如果可以竞选班长,输出 Qualified;
否则,输出 Not qualified。

样例输入 
【样例1】
91
96
99
89
【样例2】
84
91
85
95
【样例3】
94
98
97
80
样例输出 
【样例1】
Qualified
【样例2】
Not qualified
【样例3】
Not qualified
提示

样例2解释:语数外中,只有一门达到了要求
样例3解释:思想品德课低于85

0≤a,b,c,d≤100

代码如下

#include<iostream>
using namespace std;

int main()
{
	int a[4];
	for (int i = 0; i < 4; i++)
	{
		cin >> a[i];
	}
	int c = 0;
	for (int i = 0; i < 3; i++)//语数英三门
	{
		if (a[i] >= 90)//统计大于90的数目
		{
			c++;
		}
	}
	if (c >= 2 && a[3] >= 85)//有两门大于90而且政治大于85
	{
		cout << "Qualified";
	}
	else
	{
		cout << "Not qualified";
	}
	return 0;
}

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
优秀班委选举系统 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace 优秀班委选举 { public partial class Form1 : Form { private ListBox listBox; public Form1() { InitializeComponent(); } public Form1(ListBox listBox) { InitializeComponent(); this.listBox = listBox; } private void button1_Click(object sender, EventArgs e) { if (listBox1.Items.Count > 0) { if (listBox1.SelectedItem == null) { MessageBox.Show("请先选择一个对象!"); } else { //获取左边listBox1中选中的内容 string cont = listBox1.SelectedItem.ToString(); //左边listBox1中删除选中的内容 listBox1.Items.Remove(cont); //把获得的内容加入到右边的listBox2中 listBox2.Items.Add(cont); } } } private void button2_Click(object sender, EventArgs e) { if (listBox2.Items.Count > 0) { if (listBox2.SelectedItem == null) { MessageBox.Show("请先选择一个对象!"); } else { //获取右边listBox2中选中的内容 string cont = listBox2.SelectedItem.ToString(); //右边listBox2中删除选中的内容 listBox2.Items.Remove(cont); //把获得的内容加入到左边的listBox1中 listBox1.Items.Add(cont); } } } //退出 private void button5_Click(object sender, EventArgs e) { Application.Exit(); } //显示结果 private void button4_Click(object sender, EventArgs e) { //传递listBox2到Form2窗口中 Form2 form2 = new Form2(listBox2); form2.Show(); } //修改名单 private void button3_Click(object sender, EventArgs e) { if (listBox2.SelectedItem == null) { MessageBox.Show("请先选择一个对象!"); } else { string cont = listBox2.SelectedItem.ToString(); int index = listBox2.SelectedIndex; Form3 form3 = new Form3(cont, index, listBox2); form3.Show(); this.Hide(); } } //加载窗口 private void Form1_Load(object sender, EventArgs e) { if (listBox != null) { foreach (string str in listBox.Items) { listBox2.Items.Add(str); } } } } }

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Julie_Mol

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值