How to fix this sort()?

This is a discussion on How to fix this sort()? within the C++ Programming forums, part of the General Programming Boards category; Greetings, I am recieving this code but it doesn't make sense to me. Pls tell me how to fix it. ...

  1. #1
    TransparentMember correlcj's Avatar
    Join Date
    Jun 2002
    Posts
    378

    How to fix this sort()?

    Greetings,
    I am recieving this code but it doesn't make sense to me. Pls tell me how to fix it.

    Code:
    /*
    *	Specification:	
    *		Input:	
    *			Input three integers from the keyboard.
    *		Output:
    *			Sort them into ascending order onto the screen.
    *
    **************************************************************************************/
    
    #include <iostream>
    #include <numeric>		
    using namespace std;
    
    int Sort3(int);
    
    int int1, int2, int3;
    
    int main()
    {
    
    	cout << "Input three integers: \n";
    
    	cin >> int1 >> int2 >> int3;
    
    	cout << " Integers have now been sort by ascending order. " << Sort3(int1, int3) << "\n";
    	return 0;
    
    
    }
    
    
    int Sort3(int in1, int int2, int int3)
    {
    
    	Sort3(int1, int3);
    	return 0;
    }
    Here is the errors:
    error C2660: 'Sort3' : function does not take 2 parameters
    C:\Program Files\Microsoft Visual Studio\MyProjects\test\testme.cpp(39) : error C2661: 'Sort3' : no overloaded function takes 2 parameters
    Error executing cl.exe.

    test.exe - 2 error(s), 0 warning(s)

  2. #2
    moi
    moi is offline
    Registered User moi's Avatar
    Join Date
    Jul 2002
    Posts
    946
    your program makes no sense at all. you prototype Sort3() with one parameter, call it with two, and define it with three. and your Sort3() function doesnt contain any code that could be expected to, well um, sort three numbers, you know?

    now you said you're recieving this code from someone? ask them what on earth they think they're doing.
    hello, internet!

  3. #3
    TransparentMember correlcj's Avatar
    Join Date
    Jun 2002
    Posts
    378

    I wish I could?

    now you said you're recieving this code from someone? ask them what on earth they think they're doing.
    My sister would not appreciate me speaking to her that way. I'll try and fix it. Thanks for your input. I am still learning C++ and she's afraid to place her code here because of the sarcasim people say.

    Anyways... thanks, MOI!

  4. #4
    BMJ
    BMJ is offline
    Banal internet user BMJ's Avatar
    Join Date
    Aug 2002
    Location
    Chicagoland
    Posts
    1,380
    You know that by just calling a function sort() doesn't give it sorting abilities

    And why did you #include <numeric>?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 26
    Last Post: 07-05-2010, 11:43 AM
  2. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 09:18 PM
  3. Replies: 5
    Last Post: 08-02-2008, 07:23 AM
  4. Using quicksort and radix sort for an anagram program
    By RazielX in forum C Programming
    Replies: 2
    Last Post: 05-03-2004, 10:33 AM
  5. integer sort fix
    By Unregistered in forum C++ Programming
    Replies: 2
    Last Post: 08-31-2001, 08:27 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21