Click here to Skip to main content
16,006,006 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralDrawing Image For The Web Pin
Nick Parker14-May-02 14:29
protectorNick Parker14-May-02 14:29 
GeneralSort algorithm Pin
John Cruz14-May-02 12:45
John Cruz14-May-02 12:45 
GeneralRe: Sort algorithm Pin
Christian Graus14-May-02 12:51
protectorChristian Graus14-May-02 12:51 
GeneralRe: Sort algorithm Pin
John Cruz14-May-02 13:00
John Cruz14-May-02 13:00 
GeneralRe: Sort algorithm Pin
Christian Graus14-May-02 13:02
protectorChristian Graus14-May-02 13:02 
GeneralRe: Sort algorithm Pin
John Cruz14-May-02 13:15
John Cruz14-May-02 13:15 
GeneralRe: Sort algorithm Pin
Christian Graus14-May-02 13:48
protectorChristian Graus14-May-02 13:48 
GeneralRe: Sort algorithm Pin
John Cruz14-May-02 14:23
John Cruz14-May-02 14:23 
sorry about that Christian. here is my code now:

#include <iostream>
#include <algorithm>

using std::sort;
using std::cout;
using std::cin;

struct SPRITE
{
int x;
int y;
};

// Maximum number of sprites
const int N_SPRITES = 10;

bool Compare (const SPRITE &one, const SPRITE &two)
/* Pre: Enter value for one and two
* Post: Compares all of both strings
*/
{
return (one.y < two.y);
}


int main()
{
// Array of sprites
SPRITE sprites[N_SPRITES];

// Number value
int value;

for (int i=0; i<N_SPRITES; i++)
{
cout << "Enter a value: ";
cin >> value;
sprites[i].y = value;
}

sort(sprites[0], sprites[9], Compare);

for (i=0; i<N_SPRITES; i++)
{
cout << sprites[i].y;
}
return 0;
}

1st error: error C2784: '_Ty *__cdecl std::_Val_type(const _Ty *)' : could not deduce template argument for 'const *' from 'struct SPRITE'

2nd error: error C2784: '_Ty *__cdecl std::_Val_type(const struct std::iterator<_C,_Ty,_D> &)' : could not deduce template argument for 'const struct std::iterator<_C,_Ty,_D> &' from 'struc
t SPRITE'

3rd error: error C2780: 'void __cdecl std::_Sort_0(_RI,_RI,_Ty *)' : expects 3 arguments - 4 provided
c:\program files\microsoft visual studio\vc98\include\algorithm(541) : see declaration of '_Sort_0'
C:\DOCUMENTS AND SETTINGS\JOHN CRUZ.JCRUZ495\MY DOCUMENTS\MY PROJECTS\C++\Sort\main.cpp(46) : see reference to function template instantiation 'void __cdecl std::sort(struct SPRITE,struct SPRITE,bool (__cdecl *)(const struct SPRITE &,const s
truct SPRITE &))' being compiled

hey am really sorry for not providing what the errors were earlier. well anyways. I REALLY APPRECIATE ALL YOU GUYS HELP Big Grin | :-D

Thank you very much,
John Big Grin | :-D

Aloha from Hawaii Smile | :)
GeneralRe: Sort algorithm Pin
Christian Graus14-May-02 15:02
protectorChristian Graus14-May-02 15:02 
GeneralRe: Sort algorithm Pin
John Cruz14-May-02 16:32
John Cruz14-May-02 16:32 
GeneralRe: Sort algorithm Pin
Christian Graus14-May-02 17:44
protectorChristian Graus14-May-02 17:44 
GeneralRe: Sort algorithm Pin
Jon Hulatt15-May-02 0:09
Jon Hulatt15-May-02 0:09 
Generalincreasing maximum threads per process Pin
scott sanders14-May-02 12:21
scott sanders14-May-02 12:21 
GeneralRe: increasing maximum threads per process Pin
Anders Molin14-May-02 12:38
professionalAnders Molin14-May-02 12:38 
GeneralRe: increasing maximum threads per process Pin
Tim Smith14-May-02 12:44
Tim Smith14-May-02 12:44 
GeneralRe: increasing maximum threads per process Pin
Andrew Hafen14-May-02 13:07
Andrew Hafen14-May-02 13:07 
GeneralPredefined control class names Pin
ed987114-May-02 11:30
ed987114-May-02 11:30 
GeneralRe: Predefined control class names Pin
Larry Antram14-May-02 12:00
Larry Antram14-May-02 12:00 
GeneralShowing a larger image in a small PictureBox Pin
14-May-02 11:05
suss14-May-02 11:05 
GeneralRe: Showing a larger image in a small PictureBox Pin
Jason Henderson14-May-02 11:37
Jason Henderson14-May-02 11:37 
Generalstring arrays in vc++ Pin
14-May-02 10:46
suss14-May-02 10:46 
GeneralRe: string arrays in vc++ Pin
valikac14-May-02 11:25
valikac14-May-02 11:25 
GeneralRe: string arrays in vc++ Pin
Ravi Bhavnani14-May-02 17:10
professionalRavi Bhavnani14-May-02 17:10 
GeneralRe: string arrays in vc++ Pin
15-May-02 6:02
suss15-May-02 6:02 
GeneralX and Y Size Pin
14-May-02 10:16
suss14-May-02 10:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.