制作程序按字母顺序排序名称 [英] Make a program to sort names alphabetically
问题描述
我需要一个程序来列出20个学生的成绩并按字母顺序排序。我需要程序在记事本中运行
例如。
雷蒙德= 87%
马克= 67%
伯爵= 97%
Luigi = 90%
然后将它分类为
>
伯爵= 97%
Luigi = 90%
马克= 67%
雷蒙德= 87%
我尝试了什么:
我不知道如何在记事本中运行它或按字母顺序排序的命令
你不能。
记事本是一个非常基本的文本编辑器,它无法运行代码。
它也没有排序选项。即使它确实如此,它也没有选择按数值排序 - 它是一个文本编辑器,对文本本身的数字或任何格式都一无所知。
即使它确实如此,这是你的作业,而不是我们的作业 - 所以我们不会只是给你一个解决方案:你应该完成大部分工作,如果你遇到困难我们会帮助你。
我强烈建议你需要仔细阅读你的作业,因为我认为它不会告诉你做你认为的事情!
引用:我需要程序在记事本中运行
这没有意义。
我认为你的意思是你的程序应该接受一个文本文件作为输入。然后你可以利用C ++
标准库(提示:将相关项存储到map< string,int
>)
I need a program to list 20 students with their grades and sort them alphabetically. I need the program to run in notepad
For example.
Raymond = 87%
Mark = 67%
Earl = 97%
Luigi = 90%
then it will sort it to
Earl = 97%
Luigi = 90%
Mark = 67%
Raymond = 87%
What I have tried:
I don't know how to run it in notepad or the command to sort it alphabetically
You can't.
Notepad is a very basic text editor, and it cannot run code.
Nor does it have a "sort" option. Even if it did, it wouldn't have the option to sort by numeric values - it's a text editor and knows nothing about numbers or any formatting in the text itself.
Even if it did, this is your homework, not ours - so we would not be just giving you a solution: you are expected to most of the work and we will help if you get stuck.
I'd strongly suggest that you need to re-read your homework assignment carefully, as I don't think it is telling you to do what you think it is!
Quote:I need the program to run in notepad
That doesn't make sense.
I assume you meant your program should accept a text file as input. Then you may take advantage of theC++
standard library (hint: store the relevant items into amap<string, int
>).
这篇关于制作程序按字母顺序排序名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!