After compiling the program, total 12 errors apreared. Please help me to resolve. All errors are shown in attachment.

#include<iostream.h>
#include<conio.h>
void Merge(int[],int,int[],int);
void main()
{
int A[50],B[50],C[50],MN=0,M,N,z;
clrscr();
cout<<"How many elements do U want to create first array with?(max.50).....";
cin>>M;
cout<<"\n Enter first array\'s elememts[ascending].....\n";
for(int i=0;i<M;i++)
{
cin>>A[i];
}
cout<<"\n How many elements do U want to create second array with?(max.50).....";
cin>>N;
MN=M+N;
cout<<"\n Enter second array\'s elements[descending].....\n";
for(int i=0;i<N;i++)
{
cin>>B[i];
}
Merge(A,M,B,N);
cout<<"\n\n The sorted array is as shown below.....\n";
for(int i=0;i<MN;i++)
cout<<C[i]<<" ";
cout<<endl;
cin>>z;
}
void Merge(int A[],int M,int B[],int N)
{
int a,b,c;
While(A>=0&&B<n)
{
if(A<B)
C=A;
A--;
C--;
else
C=B;
B++;
C--;
if(A<0)
{
while(B<n)
C=B;
B++;
C--;
if(A<0)
{
while(B<n)
C=B;
B++;
C--;
if(B>=n)
{
While(A>=0)
C=A;
C--;
A--;
return;
}

Thank you in advance.

Recommended Answers

All 3 Replies

did you look at those errors and make any attempt to fix them yourself? For example, the error on line 33: you have misspelled the keyword while. Now, look again and see if you can't see what's wrong.

As stated by Ancient Dragon, the errors here are pretty well explained by the compiler. However, you appear to be learning from somewhere that uses some old syntax that's not best practice to use any more. I'll give you hints on those.

a) You should avoid including standard c++ headers with the .h extension. So, here, use <iostream> instead of <iostream.h> This is probably giving you a massive load of warnings at the start of the compile.

b) You should avoid declaring main as "void main()". Use "int main()" instead. This is explained in the FAQ on the main page of this forum.

That's your lot.

and avoid using conio.h because it isn't needed in c++ programs.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.