hi i have created a code to merge two char arrays for assignment plz can u guide me is it ok.how much marks can i get 4 it out of 20.
#include <iostream>
using namespace std;
//declaring the functions
void merge(char[],int, char[], int,char[],int);
void sort(char[] ,int);
void display(char[],int);
main()
{
//declaring the arrays
char a[10];
char b[10];
char result[20];
int size;
cout <<"please enter the ten alphabets ";
for (int i=0;i<=9;i++)
{
cin >>a[i];
}
cout <<"please enter the elements of second array:";
for (int j=0;j<=9;j++)
{
cin >>b[j];
}
merge(a,10,b,10,result,size);
sort (result,size);
display (result, size);
}
//----------merging-----------
void merge (char array1[],int size1, char array2[],int size2, char c[],int *size )
{
for (int k=0;k< size1;k++)
{
c [k] =array1[k];
}
for (int k=0;k<size2;k++)
{
c [size1+k] = array2[k];
*size=size1+size2;
}
}
//--------------------sorting----------------
void sort(char c[],int size)
{
int end=size-1;
for (int i=0;i<=size;i++)
{
for (int j=0;j<=end;j++)
{
if (c[j]>c[j+1])
{
char temp=c[j];
c[j]=c[j+1];
c[j+1]=temp;
}
}
}
}
//---------------display output---------------
void display (char c[],int num)
{
for (int l=0;l<num;l++)
cout <<c[l];
}