We're a community of 1.1M IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,080,548 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

can u tell me what the prob is

hello guys ! i have created a program just to understand how to return a value from using a recursive program

what it does it thati have have two variable i.e first and last
the value of first is zero and last is 10

not i want the function to continue until last ==to first
if not it would simply return the value of the last and decrement here is the code and the prob listed and yes i am noob

#include<conio.h>
#include "stdafx.h"
#include <iostream>
# define size 10;
int mergesort(int,int);
using namespace std;



int _tmain(int argc, _TCHAR* argv[])
{
    int first=0,last=10;

    //cout <<" enter the vlaues";

    //for(int i=0;i<10;i++)
    //cin>>arr[i];
    cout<<mergesort(first,last);
    system("pause");
    system("pause");
    return 0;
}

int mergesort(int first,int last,int mid)
{ int a=34343434;
   cout<<"mergesort called";
    if(first==last)
    {
                cout<<"its the end of the world";

                return a;
    }

if(first=!last)

{last--;
 cout<<"\n"<<last;
 mergesort(first,last,mid);
 return last;
}
return first;
}

here is the prob and plz tell me how to over come it

1>------ Build started: Project: merge sort, Configuration: Debug Win32 ------
1>Linking...
1>merge sort.obj : error LNK2019: unresolved external symbol "int __cdecl mergesort(int,int)" (?mergesort@@YAHHH@Z) referenced in function _wmain
1>C:\Documents and Settings\muqeet\My Documents\Visual Studio 2005\Projects\merge sort\Debug\merge sort.exe : fatal error LNK1120: 1 unresolved externals
1>Build log was saved at "file://c:\Documents and Settings\muqeet\My Documents\Visual Studio 2005\Projects\merge sort\merge sort\Debug\BuildLog.htm"
1>merge sort - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

i created this program in visual c++ 2005

3
Contributors
4
Replies
13 Hours
Discussion Span
1 Year Ago
Last Updated
5
Views
Question
Answered
a.muqeet khan
Light Poster
27 posts since Mar 2011
Reputation Points: 6
Solved Threads: 0
Skill Endorsements: 0

First things first:
Does mergesort() take two or THREE parameters? You have it both ways.

thines01
Postaholic
Team Colleague
2,433 posts since Oct 2009
Reputation Points: 447
Solved Threads: 408
Skill Endorsements: 7

this is not merge sort i was just testing a theory of mine or rather trying to understand it through experiment .
All this programdoes it that it recursivly displays counting in desending form that its

a.muqeet khan
Light Poster
27 posts since Mar 2011
Reputation Points: 6
Solved Threads: 0
Skill Endorsements: 0

Ok then, now could you please answer thines01's question so we can help you further

zeroliken
Nearly a Posting Virtuoso
1,346 posts since Nov 2011
Reputation Points: 214
Solved Threads: 206
Skill Endorsements: 15

oops it takes 2

a.muqeet khan
Light Poster
27 posts since Mar 2011
Reputation Points: 6
Solved Threads: 0
Skill Endorsements: 0
Question Answered as of 1 Year Ago by zeroliken and thines01

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page generated in 0.0732 seconds using 2.72MB