﻿﻿
﻿﻿
﻿
﻿﻿
﻿﻿

# subject

```
/************************************************************************/
/*
2． I have an array , Internal discharge 10 It's an integer . We need to find the smallest number and its subscript , Then swap it with the first element in the array
*/
/************************************************************************/
#include <stdio.h>
#include <stdlib.h>
void main()
{
int a[10];
int min;// Define the minimum value
int k;// Record subscripts
for (int i=0;i<10;i++)// Assign ten random numbers to an array
{
a[i]=rand()%100;
printf("%d\t",a[i]);
}
min=a[0];
for (int i=0;i<10;i++)// Assign the minimum value to min, Get the array minimum subscript
{
if (min>a[i])
{
min=a[i]; // min Save the minimum
k=i; // k Save the subscript of the minimum value
}
}
printf("\nmin=%d,k=%d\n",min,k);
// take a[0] and a[k] Output after exchange
a[0]=a[0]+a[k];
a[k]=a[0]-a[k];
a[0]=a[0]-a[k];
for (int i=0;i<10;i++)
{
printf("%d\t",a[i]);
}
system("pause");
}

```

Click on “ Local Windows The debugger ” perform

# Program run results

﻿﻿
﻿﻿

## be based on visual Studio2013 solve C One of the questions in the language contest 0502 More related articles on minimum decimal substitution

1. be based on visual Studio2013 solve C One of the questions in the language contest 0401 Factorial

﻿﻿ ﻿﻿ subject Solution code and comments This is a classic textbook topic , Basically every book is based on c/c++ Language textbooks all have this topic Used to demonstrate loop statements #include <stdio.h> #include ...

2. be based on visual Studio2013 solve C One of the questions in the language contest 0205 Sum of digits

﻿﻿ subject

3. be based on visual Studio2013 solve C One of the questions in the language contest 0201 Temperature conversion

subject Solution code and comments #include <stdio.h> #include <stdlib.h> void main() { float f; float c; float ...

4. be based on visual Studio2013 solve C One of the questions in the language contest 0409 100 Inner prime

﻿﻿ ﻿﻿ ﻿﻿ subject Solution code and comments On the basis of knowing how to judge prime numbers , Increase the cycle , It can be judged 100 Prime number within /******************************************* ...

5. be based on visual Studio2013 solve C One of the questions in the language contest 0408 prime number

﻿﻿ ﻿﻿ subject Solution code and comments The way to judge whether a number is prime or not , It's usually to see n Can be n An integer within (1 With the exception of ) to be divisible by In order to improve efficiency , This integer range is generally reduced to n The square root of If all integers in this range are not divisible , that ...

6. be based on visual Studio2013 solve C One of the questions in the language contest 0407 Max min

﻿﻿ ﻿﻿ subject Solution code and comments This question examines circulation and comparison /*********************************************************************** ...

7. be based on visual Studio2013 solve C One of the questions in the language contest 0406 Summation of sequences

﻿﻿ ﻿﻿ subject Solution code and comments This topic , Or to investigate for The use of recycling And the law of sequence , The characteristic of this sequence is the second n Molecules = The first n-1 Molecules + The first n-2 Molecules , So is the denominator And another rule is that n A molecule and a n- ...

8. be based on visual Studio2013 solve C One of the questions in the language contest 0405 Factorial summation

﻿﻿ ﻿﻿ subject Solution code and comments This problem is similar to the previous one , The first n An accumulation term = n-1 The sum of n times Because of this Law , We can use one for Cycle to achieve But the example code doesn't do that , You can go back and modify the code , Make the code more ...

9. be based on visual Studio2013 solve C One of the questions in the language contest 0404 Circle sum

﻿﻿ ﻿﻿ subject Solution code and comments This question tests for Loop and a simple algorithm Because the value of each accumulation is regular , The last accumulation is twice as much as the previous one So you can use a simple loop , Calculate the cumulative term and cumulative result /************ ...

## Random recommendation

1. &lt;canvas&gt; Problems with setting width and height

In the use of <canvas> You must set the width and height of the element , Specifies the size of the area that can be drawn . But there's a small problem with setting the width and height here . Sample code : <!DOCTYPE html> <html ...

2. ( Arrangement ) Json Rule of grammar

{ "staff":[ {"name":"haha1", "age":20}, {"name":&q ...

3. C++ Those things ：const From all aspects of usage

One .const What is it? stay C/C++ In language ,const A keyword is a modifier . So-called “ Modifier ”, It's in the process of compiler compilation , Give the compiler some “ requirement ” or “ Tips ”, But the modifier itself , It doesn't produce any actual code . Just con ...

4. HDU-4518 GIGO series stories —— Final number AC automata + digit DP

The question : If a segment of a number is longer than 2 The Fibonacci number of , So this number is defined as F Count , First few F The number is 13,21,34,55...... Number these numbers ,a1 = 13, a2 = 21. Now let's give a number n, Output and ...

5. JQ Add remove css style -- Reprint Have a good heart

We often use Javascript To change the style of page elements . One way is to change the page elements CSS class (Class), It's in the traditional Javascript in , We usually deal with HTML Dom Of classname characteristic ...

6. 《 Study OpenCV》 Exercises chapter four question three a

#include <highgui.h> #include <cv.h> #include "opencv_libs.h" #pragma comment ...

7. log4j Usage of

1. Import 2. stay src Under the new log4j.properties, The contents are as follows log4j.rootLogger=DEBUG, A1 ,R log4j.appender.A1=org.apache.log4j ...

8. About some basic Java The answer to the question （ One ）

It's very important to learn the basics of a language , So this article summarizes some common Java Answers to basic questions , I hope I can help you . 1. The size of nine basic data types , And their encapsulation classes . 9 Basic data types Basic types Packaging type size bool ...

9. zabbix python Wechat alarm script

test zabbix It takes a lot of time , Using open source tools (OneOaaS weixin-alert).shell Scripting tools ( Manual execution is normal , Server call failed ), None of them have realized the related functions. The following are the optimized ones Pytho ...

10. MATLAB GUI Dialog design

Original address :http://blog.csdn.net/shuziluoji1988/article/details/8532982 1. Public dialog : The common dialog is to use windows Dialog box for resources , Including documents ...