-
#include
void main()
int a[100],i, n,t;
printf("Please enter the number of arrays:");
scanf("%d",&n);
printf("Please enter %d number:",n);
for(i=0;iscanf("%d",&a[i]);
for(i=0; i < n/2; i++)t=a[i];
a[i] = a[n-i-1];
a[n-i-1]=t;
for(i=0;iprintf("%d ",a[i]);
-
#include
main()
int a[5]=;
int i,j;
for(i=0;i<2;i++) exchange element.
j=a[i];
a[i]=a[4-i];
a[4-i]=j;
for(i=0;i<5;i++) output element.
printf("%d ",a[i]);
-
To learn the concept of arrays in the C language, print arrays through the for loop output.
-
The following program runs through. The array size can be redefined in the macro definition. The array data type can also be changed and redefined.
#include
#include
#define n 10
int main()
for(i=0;iprintf("%5d",b[i]);
system("pause");
return 0;}
-
#include
#define n 5
void main()
for(i=0;iprintf("%3d",a[i]);
printf("");
for(i=0;iprintf("%3d",b[i]);
printf("");
If you don't understand, you can continue to ask.
-
for(i=0;i brother, this sentence is wrong, it should be for(i=0; i<3;i++)
printf("The processed array is")
This sentence is missing a semicolon.
printf(""This one is also a semicolon.
-
#include
The int zz(int a[3][3]) function is clearly problematic}void main().
zz(a);
printf("The processed array is")") missing;
for (i=0;i<3;i++)
-
You type a few Chinese spaces in it, just delete it.
#include
int main()}
-
There is no main function, no return value.
And your display result is to input a number and immediately return a number, it should be ideal to input and output collectively, right?
-
Nope"return 0"?Because the current computer is not safe vs, and there is no way to verify it, you can run and see.
-
for(int i=0;iShift-left of the plural system.
a[n]=b;
That's probably what it looks like bai.,Note that the type of the b and the array should be the same.,I didn't debug it.,dao you try it yourself.。
-
With a loop, you can shift the array to the left with a loop:
int i,n,temp;
int a[n];
temp=a[0];
for(i=0;ia[n-1]=temp;
-
It's actually quite simple to put the first.
For example, a[0] is saved with a variable, then the special value of the latter element is assigned to the previous one, and finally the value of the variable that holds a[0] is assigned to the last element, and the loop is . For an array, it should be implemented in a double loop, with the outer loop representing the number of times you need to move left, and the inner loop shifting each element to the left.
-
for(int i=0;ibai
The number of times the left shift.
That's probably what zhi looks like.,Note that the dao type of b and the array should be the same.,I didn't debug it.,You have the right to try it yourself.。
-
Add an auxiliary variable to store the first element of the array, then replace each element with the last one from back to front, and replace the last element with an auxiliary variable. Nope.
-
#include
main()
printf("now array a:");
for (i = 0; i < 5;i++) *to output the converted array again*
printf("%d ", a[i]);
-
The C array has only 12 elements, and the n++ you hit it one more time, and the array is out of bounds.
It's nonsense to say so much above. Landlord please see: pay attention to your program: printf("%d,%d",(a,b),(b,a); >>>More
It's not very hard that the tail node next points to null. >>>More
I'll give you an easy way to do it, and I use it when I was in college, and I don't know if you can use it. >>>More
3. All include
using namespace std; >>>More
It seems that the 2 people upstairs are not C++).
Treat Chinese characters as if they were English letters. Header file iostream is sufficient. Main Functions: >>>More