sorting

How can I alphabetize strings from an array in c++?

泪湿孤枕 提交于 2020-01-05 08:27:33
问题 I have to write a program that sorts 10 people by height, then by last name. I've got the height down, but i can't get the last name sort to work. I'm trying to use strcmp for it. Any time I try to run it though, it flags an error at the strcmp saying, "[Error] cannot convert 'std::string {aka std::basic_string}' to 'const char*' for argument '1' to 'int strcmp(const char*, const char*)'" I'm using strcmp because this is for a school assignment and I am limited by my knowledge of c++ and what

sort array both ascending and descending using jquery

空扰寡人 提交于 2020-01-05 07:49:12
问题 I am trying to sort my array, both ascending and descending. I cant seem to figure out how to do this correctly though. I tried with different methods, but none worked. This is supposed to happen when i click two button, one with the id "stigande"ascending and one with the id "fallande"descending. Any solution? Javascript $(document).ready(function(){ var $films = []; // ändra bakgrundsfärg för textfield $('#name').keyup(function(){ $('#name').css('background-color', 'white'); }); // ändra

Why am I getting an existence error on predsort?

安稳与你 提交于 2020-01-05 07:37:17
问题 I am trying to sort a list of paths by the distance it takes to complete them. The Prolog code I'm using is below. When I call sortRoutes , I get an existence error from Prolog saying that predsort doesn't exist. However, I am using the sort module and that doesn't seem to change anything. I can't seem to figure out why this isn't working. Am I doing anything wrong? Thanks! :- use_module(library(sort)). sortRoutes(DistRoutes, SortedRoutes) :- predsort(distCompare, DistRoutes, SortedRoutes).

Why am I getting an existence error on predsort?

泄露秘密 提交于 2020-01-05 07:35:02
问题 I am trying to sort a list of paths by the distance it takes to complete them. The Prolog code I'm using is below. When I call sortRoutes , I get an existence error from Prolog saying that predsort doesn't exist. However, I am using the sort module and that doesn't seem to change anything. I can't seem to figure out why this isn't working. Am I doing anything wrong? Thanks! :- use_module(library(sort)). sortRoutes(DistRoutes, SortedRoutes) :- predsort(distCompare, DistRoutes, SortedRoutes).

JavaFX make bar chart changing bars with delay in UI Thread

家住魔仙堡 提交于 2020-01-05 07:32:30
问题 I got JavaFX main thread, there I create new Thread that extends Task and sort and replace bars. Everyhing is good, but I want to make some delays(like 100ms) while replacing to show step by step sorting, maybe with animation. The problem is when I use Thread.sleep() or TranslateTransition() it just sum all delays miliseconds together in one big delay that happens before changing bars. How can I make delay that will work properly in UI thread? In main class: Sorting sorting = new Sorting();

How to sort array of strings in ascending order in C

给你一囗甜甜゛ 提交于 2020-01-05 07:25:41
问题 Problem I have made sorting program which is similiar to other found at https://beginnersbook.com/2015/02/c-program-to-sort-set-of-strings-in-alphabetical-order/ but program which i made is not working. I think both are same but my program giving me waste output. Also i want to know in other program count is set to 5 for example and it should take 6 input starting from 0 but it is getting only 5,How? My Program #include <string.h> #include <stdio.h> int main() { char str[4][10],temp[10]; int

Set Ascending Descending for each column when sorting by multiple columns [duplicate]

隐身守侯 提交于 2020-01-05 06:52:11
问题 This question already has answers here : Sort by multiple keys using different orderings [duplicate] (3 answers) Closed last year . I have a list d that I wish to sort. I sort by the first column first. If its a tie there I then go on to use the second column to sort. Say I want to sort by the first column in ascending order but sort by the second column in descending order. Ascending being the default, using the reverse key I thought the below should work. sorted(d,key=lambda x: (x[0],x[1])

[ valueForUndefinedKey:]: this class is not key value coding-compliant for the key appointmentDate.' - swift

孤街醉人 提交于 2020-01-05 06:28:20
问题 i want to sort an array of object below is my function to sort the array of object class func Fn_SortByParameter(arrayToSort:NSMutableArray,paramName:NSString!, isAscending:Bool!){ var sortDescriptor:NSSortDescriptor = NSSortDescriptor(key: paramName, ascending: isAscending, selector: Selector("localizedCompare:")) var sortDescriptors:NSArray = NSArray(object: sortDescriptor) var sortedArray:NSArray = arrayToSort.sortedArrayUsingDescriptors(sortDescriptors) arrayToSort.removeAllObjects()

Reporting services + sort expression

眉间皱痕 提交于 2020-01-05 05:56:10
问题 Greetings, In my reporting services I would like to add sorting. Is there any way I can add sorting by two fields inside one column's sort expression? something like: =Fields!SomeValue1.Value =Fields!Somevalue2.Value when I use this sort expression, values are not sorted correctly. Values I would like to sort are something like SomeValue1 SomeValue2 10 11 9 1 20 21 13 12 13 7 17 6 The case is that SomeValue1 and SomeValue2 comes from another value that as follows: 10-11 9-1 20-21 13-12 13-7

multipoint regular expressions match with less for loops and less class re-initialization. optimization

一世执手 提交于 2020-01-05 05:56:07
问题 Is there a way to do multiple regular expressions matches in vba without instantiating multiple instances of the regexp object? For example I want to do several points of regular expression matching between several different fields of data. For illustrative purposes consider this. column 1 column 2 column 3 AAATDD Airplane Transportation/Airplane BBBTDD Bus Transportation/Bus CCCFDD Chocolate Food/Chocolate DDDFDD Dog Food/Potato So as you can see the first letter in Column 1 is A, which