C implements a one digit array to implement interchange implemented with FOR loops .

Updated on technology 2024-02-09
17 answers
  1. Anonymous users2024-02-05

    #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]);

  2. Anonymous users2024-02-04

    #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]);

  3. Anonymous users2024-02-03

    To learn the concept of arrays in the C language, print arrays through the for loop output.

  4. Anonymous users2024-02-02

    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;}

  5. Anonymous users2024-02-01

    #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.

  6. Anonymous users2024-01-31

    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.

  7. Anonymous users2024-01-30

    #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++)

  8. Anonymous users2024-01-29

    You type a few Chinese spaces in it, just delete it.

    #include

    int main()}

  9. Anonymous users2024-01-28

    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?

  10. Anonymous users2024-01-27

    Nope"return 0"?Because the current computer is not safe vs, and there is no way to verify it, you can run and see.

  11. Anonymous users2024-01-26

    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.。

  12. Anonymous users2024-01-25

    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;

  13. Anonymous users2024-01-24

    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.

  14. Anonymous users2024-01-23

    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.。

  15. Anonymous users2024-01-22

    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.

  16. Anonymous users2024-01-21

    #include

    main()

    printf("now array a:");

    for (i = 0; i < 5;i++) *to output the converted array again*

    printf("%d ", a[i]);

  17. Anonymous users2024-01-20

    The C array has only 12 elements, and the n++ you hit it one more time, and the array is out of bounds.

Related questions
8 answers2024-02-09

It's nonsense to say so much above. Landlord please see: pay attention to your program: printf("%d,%d",(a,b),(b,a); >>>More

4 answers2024-02-09

It's not very hard that the tail node next points to null. >>>More

8 answers2024-02-09

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 answers2024-02-09

3. All include

using namespace std; >>>More

5 answers2024-02-09

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