Error returning items not repeated and in alphabetical order

-3

The code is in the image.

Valentina is a very dedicated woman who works late every day.To save time, she makes the market shopping list in an application and usually writes down each item at the same time that she notices it house.

The problem is that the application does not delete duplicate items and as Valentina is distracted, she notes the same item more than once and the list ends up being extensive. Your task as a programmer and friend of Valentina is to improve the application of notes by developing a code that excludes duplicate items from the shopping list and orders them alphabetically.

Entrance The first entry line contains an integer N (N < 100) that indicates the number of test cases that follow, or rather the number of shopping lists that Valentina wants to organize. Each shopping list consists of a single line containing 1 to 1000 items or words composed only of lowercase letters (1 to 20 letters), without accents and separated by a space.

Output The output contains N rows, each representing one of Valentina's shopping lists, without repeated items in alphabetical order. "

The error suggestion is that it has to do with some vector that is less capable than it needs or I'm trying to access an invalid memory, but have no idea how to fix it.

Help me, please!

    
asked by anonymous 04.11.2018 / 02:44

1 answer

0

Good afternoon, my friend. The error in your code is in the following line:
if (! Strcmp (vi [i], vi [i + 1]) == 0)
It is generating an address burst in memory when it reaches the end of the vector. Home Check the variables of the counters, such as l1 by placing the debugging program line-to-line. I hope I have helped you.

    
04.11.2018 / 17:58