Month

Brief Information about the April 99 CSIG Meeting

Music Selection Permutations

by Bruce Arnold


Welcome to the C++ Users Group for April 1999.
    1   /*      music.cpp               B.Arnold        3-08-1993  4-16-99
    2   
    3       Object:  To calculate the total play time of a list of music
    4                selection times in relation to the size of a recording
    5                tape.  The program will try to find the closest
    6                group of selections which will fit on a tape.  The program 
    7                will accept data interactively from the keyboard, or from 
    8                a data file containing the selection times.  "Piping" to 
    9                the DOS "sort" program will put the output data in order.
   10   
   11     Concepts:  The program demonstrates the following programming concepts:
   12               1. Console input and output.
   13               2. Redirection of 'stdin'.
   14               3. String format conversions.
   15               4. Floating point number conversions.
   16               5. Recursive programming.
   17   
   18     Compiler: VC++ version 5
   19   */
   20   
   21   #define VERSION "\n\
   22   MUSIC.exe                               Version 1.20 by B.Arnold  4-16-1999\n\
   23   \n\
   24   The object of this program is to calculate all permutations of a list of\n\
   25   music selection times so that a reduced set will fit into a given time limit.\n\
   26   \n\
   27   Usage:  MUSIC   or   MUSIC datafile   or   MUSIC datafile | sort /R\n\n"
   28   
   29   
   30   /*
   31       Sample input Data:             ������ͻ
   32                                      � 35   �<----- target time
   33                                      � 4:21 �<----- times of each music section
   34                                      � 4:01 �
   35                                      � 4:00 �
   36                                      � 3:37 �
   37                                      � 3:34 �
   38                                      � 3:27 �
   39                                      � 3:04 �
   40                                      � 4:46 �
   41                                      � 2:47 �
   42                                      � 5:49 �
   43                                      ������ͼ
   44       Resulting output Data:
   45     �����������������������������������������������������������������������ͻ
   46     � Target=35:00                                                          �
   47     � ====================                                                  �
   48     � 40:16 ALL  4:26  4:06  4:05  3:42  3:39  3:32  3:09  4:51  2:52  5:54 �
   49     � 34:22 ...  4:26  4:06  4:05  3:42  3:39  3:32  3:09  4:51  2:52  ---- �
   50     � 34:15 ...  4:26  4:06  4:05  3:42  3:39  3:32  ----  4:51  ----  5:54 �
   51     � 33:52 ...  4:26  4:06  4:05  3:42  3:39  ----  3:09  4:51  ----  5:54 �
   52     � 33:45 ...  4:26  4:06  4:05  3:42  ----  3:32  3:09  4:51  ----  5:54 �
   53     � 33:42 ...  4:26  4:06  4:05  ----  3:39  3:32  3:09  4:51  ----  5:54 �
   54     � 33:35 ...  4:26  4:06  4:05  3:42  3:39  ----  ----  4:51  2:52  5:54 �
   55     � 33:28 ...  4:26  4:06  4:05  3:42  ----  3:32  ----  4:51  2:52  5:54 �
   56     � 33:25 ...  4:26  4:06  4:05  ----  3:39  3:32  ----  4:51  2:52  5:54 �
   57     � 33:19 ...  4:26  4:06  ----  3:42  3:39  3:32  3:09  4:51  ----  5:54 �
   58     � .............................                                         �
   59     �     Note:  an extra 5 seconds has been added to each item in order    �
   60     �            to compensate for the dead space between selections.       �
   61     �����������������������������������������������������������������������ͼ
   62    */

"Random Access" questions start at 7:30 Tuesday night.

SOURCE CODE

Source Code Files

For help, email me at b a r n o l d @ b l a s t . n e t
Back to C++ Main Page