really sorry for that,
here is the complete code:
#include<iostream>
using namespace std;
void print(int arr[], int index[], int n)
{
int i=1;
while(i<=n)
{
cout<<arr[index[i]]<<" ";
i++;
}
cout<<endl;
}
void solve(int index[], int arr[], int target, int cursum, int n, int sz)
{
if(cursum>target)
return;
if(cursum==target)
print(arr,index,n);
for(int i=index[n];i<sz;i++)
{
index[n+1]=i;
solve(index,arr,target,cursum+arr[i],n+1,sz);
}
}
void solve(int arr[], int target, int len)
{
int index[100];
index[0]=0;
solve(index,arr,target,0,0,len);
}
int main()
{
int arr[]={5,15,25};
int sum = 0;
int len = sizeof(arr)/sizeof(arr[0]);
int target = 100;
solve(arr,100,len);
}
On Wed, Aug 3, 2011 at 1:26 AM, Ravinder Kumar <[email protected]> wrote:
> void solve(int index[], int arr[], int target, int cursum, int n, int sz)
>
> solve(arr,100,len);
>
> conflict between call and definition of function solve
>
> --
> *With Regards :*
>
> Ravinder Kumar
> B.Tech Final Year
> Computer Science and Engineering
> MNNIT Allahabad
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
--
Regards,*
Aanchal Goyal*.
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.