Results 1 to 6 of 6

Thread: How to sort and list characters in C++

  1. #1
    Join Date
    Jan 2010
    Posts
    48

    How to sort and list characters in C++

    I need help creating a program to meet some criteria. To summarize a little operation which I hope will work: it is a program that would allow me to list and sort characters (whose number will be requested at the beginning) according to their velocity and their initiative (two integers) while knowing that they must appear as many times as they can in their action, ie "Speed/2 = number of shares". The sorting must be done fairly (ie do not cram all the actions of a person before the other, unless the speed of one is x times greater than another, in which case it is allowed) .

  2. #2
    Join Date
    May 2008
    Posts
    2,389

    Re: How to sort and list characters in C++

    What do you want from us? Are you asking us the question how to code that or you need some suggestions in your task? Do you want us to code for you and if this is the case then it is always said that we don't provide complete program over here, this forum is just to help you and not to perform your homeworks! If you need some suggestions then can you provide us more info like what have you tried and where you need help and all that! Can you be more specific on your point?

  3. #3
    Join Date
    Jan 2010
    Posts
    48

    Re: How to sort and list characters in C++

    Well, I would need help on several points:

    - Is it possible to create a table that has in column attribute: a String, 4 Int and Bool.
    - Is it possible to create a table variable in shape (but fixed in the program, no preset number of rows).
    - If I galley too, do you know where can i get resolution of all this things? (because I think I threw myself into something too big...)

  4. #4
    Join Date
    May 2008
    Posts
    2,389

    Re: How to sort and list characters in C++

    Quote Originally Posted by Gaganadipika View Post
    - Is it possible to create a table that has in column attribute: a String, 4 Int and Bool.
    Yes it's possible after what is not known if the C++ or C, but for simplicity a class or structure can allow you to have a table with all that. If you want to identify the row its the string, then in C I do not know, in C++ the map can help you. Maps are a kind of associative containers that stores elements formed by the combination of a key value and a mapped value. For example, a typical example of a map is a telephone guide where the name is the key and the telephone number is the mapped value.

    Quote Originally Posted by Gaganadipika View Post
    - Is it possible to create a table variable in shape (but fixed in the program, no preset number of rows).
    Yes we call it a dynamic array, quite simply, its a table where you can add an element to the table. After that depends on your application then use to know a little more.

  5. #5
    Join Date
    Jan 2010
    Posts
    48

    Re: How to sort and list characters in C++

    It is true that I had not thought about the maps. You can use a pointer with a map if I remember rightly? In this case, the biggest problem (well I think ...) is already partially solved!

    it's possible after what is not known if the C++ or C
    That is C++. I think for my problem, using pointers to me but I will not know if this is possible in C itself.

  6. #6
    Join Date
    May 2008
    Posts
    2,389

    Re: How to sort and list characters in C++

    Pointers, all that does not clear of C++ comes from C is a large party. And pointers are present in C, but I advise you the C++, usually more simple.

    If yes, you can put everything in a map and a pointer is a type as another.

Similar Threads

  1. Replies: 5
    Last Post: 13-05-2011, 03:53 PM
  2. Sort a list by comparing the double
    By TechGate in forum Software Development
    Replies: 5
    Last Post: 26-02-2010, 03:46 AM
  3. Better way to sort a linked list in c++
    By Juany in forum Software Development
    Replies: 5
    Last Post: 13-02-2010, 04:30 PM
  4. Sort list alphabetically in java
    By New ID in forum Software Development
    Replies: 5
    Last Post: 11-02-2010, 12:38 AM
  5. List of Invalid characters for a username.
    By ridergroov in forum Active Directory
    Replies: 2
    Last Post: 30-07-2008, 10:33 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,966,249.39346 seconds with 17 queries