输入10个学生的姓名、学号和成绩,将其中不及格者输出
2015-08-22 17:10
495 查看
输入10个学生的姓名、学号和成绩,将其中不及格者的姓名、学号和成绩输出
#include "stdafx.h"
#include<iostream>
#include<string>
using namespace std;
string name[50]; //name定义为字符串数组,用来存放学生姓名
int num[20],score[10];
void put()
{
int i;
for(i=0;i<10;i++)
{
cout<<"请输入第"<<i+1<<"个学生的资料:";
cin>>name[i]>>num[i]>>score[i];
}
}
void find()
{
cout<<"不及格的学生有:"<<endl;
int j;
for(j=0;j<10;j++)
{
if(score[j]<60)
{
cout<<name[j]<<" "<<num[j]<<" "<<score[j]<<endl;
}
}
}
int _tmain(int argc, _TCHAR* argv[])
{
put();
cout<<endl;
find();
return 0;
}
#include "stdafx.h"
#include<iostream>
#include<string>
using namespace std;
string name[50]; //name定义为字符串数组,用来存放学生姓名
int num[20],score[10];
void put()
{
int i;
for(i=0;i<10;i++)
{
cout<<"请输入第"<<i+1<<"个学生的资料:";
cin>>name[i]>>num[i]>>score[i];
}
}
void find()
{
cout<<"不及格的学生有:"<<endl;
int j;
for(j=0;j<10;j++)
{
if(score[j]<60)
{
cout<<name[j]<<" "<<num[j]<<" "<<score[j]<<endl;
}
}
}
int _tmain(int argc, _TCHAR* argv[])
{
put();
cout<<endl;
find();
return 0;
}
相关文章推荐
- 【Nutch】Nutch的抓取流程
- VS2012加载DLL编译出现试图加载格式不正确的程序; 以及运行出现Mixed mode assembly is built against version 'v2.0.50727' of the
- Java实现二叉树的先序、中序、后序、层级遍历
- 动态限制UITextField或UITextView用户输入中英文混编字数统计
- Xml的读取
- 【8-22】java学习笔记04
- 湖南省第八届大学生计算机程序设计竞赛1115: 最短的名字(模拟)
- java性能测试中遇到的奇怪现象
- 湖南省第九届大学生计算机程序设计竞赛1334: 好老师 (模拟)
- 进程和线程之间的通信
- js文件制作博客的目录索引
- 20150820-Linux命令概述及一些基本命令
- vim编辑器简单使用(4)
- Linux信号通讯编程(国嵌总结)
- Events and Delegates(事件和委托)
- LeetCode2.1.21(Gas Station)
- 哈哈
- 清理 /boot分区多余的内核 版本
- jquery文件上传控件 Uploadify
- Events and Delegates(事件和委托)