学生排队 [英] Student Line up

查看:96
本文介绍了学生排队的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要帮助开始这个。


老师要求所有学生按照名字排成一个档案。编写一个程序,要求用户输入类中的sudents数,然后循环读取多个名称。一旦读完所有的名字,它就会报告哪个学生在前面,哪个学生在最后。假设没有两个学生有相同的名字。

I NEED HELP GETTING THIS STARTED.

A teacher has asked all her students to line up in a single file according to first name. Write a program that asks the user to enter the number of sudents in the class, and then loops to read in that many names. Once all the names have been read in it reports which student would be at the front and which student would be at the end. Assume no two students have the same name.

推荐答案

本网站的专家非常乐意帮助您解决问题,但他们无法完成您的作业/计划您。首先尝试自己的作业/计划并发布有关您遇到的任何困难或有关您不知道如何实现的特定代码功能的问题。


请阅读< a href =http://bytes.com/forum/faq.php?faq=posting_guidelinestarget =_ blank>发布指南,尤其是课程作业发布指南


然后当你准备好在这个主题中发布一个新问题。


MODERATOR
The experts on this site are more than happy to help you with your problems but they cannot do your assignment/program for you. Attempt the assignment/program yourself first and post questions regarding any difficulties you have or about a particular function of the code that you don''t know how to achieve.

Please read the Posting Guidelines and particularly the Coursework Posting Guidelines.

Then when you are ready post a new question in this thread.

MODERATOR


到目前为止我有...

#include< iostream>

使用命名空间std;


int main()

{

int学生;

cout<< 输入班级中的学生人数:\ n;

cin>>学生;


while(学生< = 1 ||学生> = 25)

{

cout<< ; 输入一个不小于1且不大于25的数字:;

cin>>学生;

}

在此之后我不完全得到它所要求的内容(关于循环读取它的部分)
so far i have..
#include <iostream>
using namespace std;

int main()
{
int students;

cout << "Enter in the number of students in the class: \n";
cin >> students;

while (students <= 1 || students >= 25)
{
cout << "Enter in a number that is no less than 1 and no more than 25: ";
cin >> students;
}
After this i do not exactly get what it is asking(the part about looping to read it)



while(学生< = 1 ||学生> = 25)
while (students <= 1 || students >= 25)



之前学生的价值是多少你进入循环吗?


另外,如果我输入1,则1< = 1为真。所以我留在循环中。如果我输入25,则25> = 25为真。所以我留在循环中。


我看起来这个循环选择了一个介于2到24之间的值。我这是你想要的吗?


您现在所做的就是在另一个循环中使用学生,要求提供名称,将其存储在某处并询问下一个名称,直到您输入学生变量中的名称数量为止。


稍微提高一点后再次发布。

What is the value in students before you enter the loop?

Also, if I enter 1, then 1 <=1 is true. So I Stay in the loop. If I enter 25, then 25>=25 is true. So I stay in the loop.

I looks like this loop selects a value between 2 and 24. I this what you intend?

All you do now is use students in another loop that asks for the name, stores it somewhere and asks for the next name until you have entered the number of names in the students variable.

Post again when you have advanced a little.


这篇关于学生排队的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆