-
Some files are included.
#include
#include
#include
void main()
Declaring variables. int a[200], i;
file *fp;
fp = fopen("", "wb");Open the file in read-write mode.
for(i=0; i<200; i++)
a[i] = rand();Generate random numbers.
fprintf( fp, "%d ", a[i]) to save the random number to a file.
if((i+1)%10 == 0) If it's a multiple of 10, wrap the line.
fprintf(fp, "%s","" );Save the line breaks to the file as well.
fclose(fp);Close the file.
Here's the sorting algorithm, bubbling sort (with halfway exits).
for(i=199;i>0;i--)
int flag=1;A sign, if all lined up, exit halfway.
for(int j=0;ja[j+1]) If you find that the front ones are bigger than the ones in the back, swap them.
The following 3 sentences are exchanged**.
int t=a[j+1];
a[j+1]=a[j];
a[j]=t;
flag=0;There is an exchange, which means that it is still in line, and there is no exchange, which means that it is all arranged.
if(flag) break;If it's arranged, it exits the sort loop.
fp = fopen("", "wb");Open the file.
for(i=0; i<200; i++)
printf("%d ", a[i]);output to the screen.
fprintf( fp, "%d ", a[i]) to a file.
if((i+1)%10 == 0) how is a multiple of 10.
printf("");Line breaks.
fprintf(fp, "%s","" );Output a line break to a file.
fclose(fp);Close the file.
-
The process is as follows. Open the file.
Write two hundred random numbers.
Sort two hundred random numbers.
Read read files, showing the number of 200 files and the number of sorted.
-
5 Rotten 3 (82 27) (A: 26 9), 5 3 (41 3), (2 9), (A. 13), (2 9), 5 3 (Faith, 41 3), (I. 13).
5 Socks leak 3-41-39
65 39 a 41 39
65-41) 39 14 39.
-
The second half: (82 Qin smiled sullenly and 27) (26 9).
82 27) (9 26) = -41 39, (27 and 9 approx. 9, 82 and 26 approx. 2).
Original = 5 3 41 39
-
1 ;x+1<2x+1<4x+3
x+1<2x+1, x>0, 2x+1<4x+3, x>-1, solution: x>0
2 ;(x-5)(x+1/2)>0
x-5>0, x+1 2>0, x>5 or x-5<0, x+1 2<0, x<-1 2, the solution set is.
3 ;|3x-8|>3
3x-8>3 or 3x-8<-3,
The reasons are generally as follows:
1. The total load of household appliances exceeds the power capacity of the switch. For example, if the total power consumption of an appliance running at the same time is up to 10kW, the circuit current can be reached, and if the rated current of the switch is only 30A, it will trip due to overcurrent protection. You can observe whether there are too many high-power appliances (air conditioners, instantaneous water heaters, etc.) turned on at home when tripping, if so, turn off some of the electrical appliances to see if it can be solved, if some are turned off to solve, it means that it is indeed caused by overload, and you can replace the switch with a higher current. >>>More
The feeling of the first year of junior high school.
Today, we are no longer children who have played in the grass; Today, we are no longer elementary school students who read aloud "Moonlight in front of the bed"; Today we have said goodbye to childhood and moved towards youth. With a vision for the future, we came to the High School Affiliated to the National People's Congress and entered the first year of junior high school. >>>More
Hello, it is recommended to divide it, so that you will not be happy, or you can find a breakthrough!
The most classic is this sentence: "Teacher, so preach, teach, and solve doubts." "The first thing in preaching is to set the right goals for students in life. secondly, systematically teach all kinds of knowledge; Third, it is a specific problem for students. >>>More
Baichuan: Many rivers.
Irrigation: infusion, inflow. >>>More