删除数组中的重复条目 [英] removing duplicate entries in an array

查看:61
本文介绍了删除数组中的重复条目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好我在找出如何删除数组中的重复条目时遇到问题...编写一个接受整数序列(其中一些可能重复)的程序作为输入

到数组中。编写一个处理数组的函数,以便消除任何重复值。写

输出函数打印出数组的值。您可以假设输入中的整数不超过20

。但可能会少一些。零表示输入结束。零不应该打印



例如,当您的程序提供以下输入时:


5 6 22 5 22 7 6 0


您的程序应该打印:


5 6 22 7


继承人我得到了什么,我尝试了一些东西删除欺骗但它甚至无法编译,我无法弄明白。我所拥有的是一个程序,它接收条目并打印出来但我需要一些帮助删除欺骗。非常感谢你的帮助。

Hello Im having problems figuring out how to remove the duplicate entries in an array...Write a program that accepts a sequence of integers (some of which may repeat) as input
into an array. Write a function that processes the array so that any duplicate values are eliminated. Write
an output function that prints out the values of the array. You can assume that there are no more than 20
integers in the input. But there may be less. Zero signifies the end of input. The zero should NOT be
printed.

For example, when the following input is provided to your program:

5 6 22 5 22 7 6 0

your program should print:

5 6 22 7

heres what I got and I tried a few things to remove the dupes but it wouldn''t even compile I cant figure it out. What I have is a program that takes in the entries and prints them out but I need some help removing the dupes. ANy help will be greatly appreciated.

展开 | 选择 | Wrap | 行号

推荐答案

这里发布的内容编译得很好 - 在我之后添加返回0;最后的声明。你有这个部分,或者还有一个尚未见过的重复删除部分有问题吗?
What you have posted here compiles fine - after I add a return 0; statement at the end. Was there a problem for you with this part, or with the as-yet-unseen duplicate-removal portion?



你好我有问题弄清楚如何删除数组中的重复条目...编写一个接受整数序列(其中一些可能重复)的程序作为输入

到一个数组中。编写一个处理数组的函数,以便消除任何重复值。写

输出函数打印出数组的值。您可以假设输入中的整数不超过20

。但可能会少一些。零表示输入结束。零不应该打印



例如,当您的程序提供以下输入时:


5 6 22 5 22 7 6 0


您的程序应该打印:


5 6 22 7


继承人我得到了什么,我尝试了一些东西删除欺骗但它甚至无法编译,我无法弄明白。我所拥有的是一个程序,它接收条目并打印出来但我需要一些帮助删除欺骗。非常感谢你的帮助。
Hello Im having problems figuring out how to remove the duplicate entries in an array...Write a program that accepts a sequence of integers (some of which may repeat) as input
into an array. Write a function that processes the array so that any duplicate values are eliminated. Write
an output function that prints out the values of the array. You can assume that there are no more than 20
integers in the input. But there may be less. Zero signifies the end of input. The zero should NOT be
printed.

For example, when the following input is provided to your program:

5 6 22 5 22 7 6 0

your program should print:

5 6 22 7

heres what I got and I tried a few things to remove the dupes but it wouldn''t even compile I cant figure it out. What I have is a program that takes in the entries and prints them out but I need some help removing the dupes. ANy help will be greatly appreciated.
展开 | 选择 | Wrap | 行号



您发布的内容这里编译好 - 我添加一个返回0;最后的声明。对于这部分,还是对于尚未看到的重复删除部分,您是否有问题?
What you have posted here compiles fine - after I add a return 0; statement at the end. Was there a problem for you with this part, or with the as-yet-unseen duplicate-removal portion?



正如ganon11所说的那样,我猜的是返回0;声明将使程序运行..

as ganon11 have said, i guess having the return 0; statement would make the program run..


这篇关于删除数组中的重复条目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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