On this occasion I will give tutorials to my friends all about C + + programming language that discusses the array that will be compiled in the command pront and there are two types of arrays to be displayed ie simple arrays and arrays in the form of procedures, either directly in stage of manufacture and follow the steps below:
The first step is to create the file first and the author creates the file with the array name for the simple array and arrayprosuder for the array prosuder
The second step is that you have to write the syntax that the author will share and of course each syntax will be described in detail as below:
In this syntax serves as declaration to start typing syntax
#include
void main()
In syntax this time function as integer number which is made on each declaration and its integer number there are 3 variables where variable a and b have number filled inside of sedangka variable c summing between both variable and for useful as repeat command as much as 5 times.
{
int a[5]={1,2,3,4,5};
int b[5]={1,2,3,4,5};
int c[5],i;
for(i=0;i<5;i++)
In this syntax serves as showing the results of the previous declaration
{
printf("[ A ] = %d [ B ] = %d \n\n",a[i],b[i]);
}
printf("\n");
for(i=0;i<5;i++)
In this syntax serves as a summation between array variables a and variable array b where the variable c which is the brain pemakainnya operator then followed by repetition then the results are displayed summing arrays a and b.
{
c[i]=a[i]+b[i];
}
for (i=0;i<5;i++)
{
printf("Penjumlahan Array A dan B adalah = %d\n",c[i]);
}
}
All syntax for Array Here:
#include
void main()
{
int a[5]={1,2,3,4,5};
int b[5]={1,2,3,4,5};
int c[5],i;
for(i=0;i<5;i++)
{
printf("[ A ] = %d [ B ] = %d \n\n",a[i],b[i]);
}
printf("\n");
for(i=0;i<5;i++)
{
c[i]=a[i]+b[i];
}
for (i=0;i<5;i++)
{
printf("Penjumlahan Array A dan B adalah = %d\n",c[i]);
}
}
This syntax is the same as most commands for most array calls that first declare and then create variables and add those variables then do the loop and show the loop result
#include
void hitung(int c[5])
{
int a[5]={1,2,3,4,5};
int b[5]={1,2,3,4,5};
int i;
for(i=0;i<5;i++)
{
c[i]= a[i]+b[i];
}
for(i=0;i<5;i++)
{
printf("\nHasilnya adalah %d",c[i]);
}
}
The following syntax functions create the second array variable just as they are summed and then repeated again and the result is displayed variable a via
printfcommand
void main()
{
int a[5]={1,2,3,4,5};
int b[5]={1,2,3,4,5};
int c[5];
int i;
for(i=0;i<5;i++)
{
printf("Nilai dari Array A[%d] = %d\n",i,a[i]);
}
Function syntax below to display the sum of array variables b
printf("\n");
for(i=0;i<5;i++)
{
printf("Nilai dari Array B[%d] = %d\n",i,b[i]);
}
hitung(c);
}
All syntax for the summing Array of procedures:
#include
void hitung(int c[5])
{
int a[5]={1,2,3,4,5};
int b[5]={1,2,3,4,5};
int i;
for(i=0;i<5;i++)
{
c[i]= a[i]+b[i];
}
for(i=0;i<5;i++)
{
printf("\nHasilnya adalah %d",c[i]);
}
}
void main()
{
int a[5]={1,2,3,4,5};
int b[5]={1,2,3,4,5};
int c[5];
int i;
for(i=0;i<5;i++)
{
printf("Nilai dari Array A[%d] = %d\n",i,a[i]);
}
printf("\n");
for(i=0;i<5;i++)
{
printf("Nilai dari Array B[%d] = %d\n",i,b[i]);
}
hitung(c);
}