Entry questions, the majority of test algorithms, common learning!
1. Programmed to count the number of positive numbers, negative numbers, and zeros in the 50 real numbers entered.
2. program, calculate and output all the integer solutions of the equation x2+y2=1989.
3. Program, enter a 10 binary positive integer, and then output its corresponding octal, hexadecimal number.
4. If a number is equal to the sum of its factors, this number is called the "end number". The program finds all the finished numbers within 1000 and outputs its factor (6 is a "finish", and its factor is a "number of").
5. Enter a positive integer to output all of its prime number factors (such as the prime number factor of 180 is 2, 2, 3, 3, 5).
6. Enter 20 integers into an array that outputs those array elements that can be divisible by other elements in the array.
7. Enter two arrays (the number of array elements is self-defined) and output the elements that appear in the two arrays (for example, a[5]={2,3,4,5,6},b[6]={3,5,7,9,10,-1}, Output 3, 5).
8. Enter two arrays (number of array elements), output elements that do not appear in two arrays (such as a[5]={2,3,4,5,6},b[6]={3,5,7,9,10,-1}, Output 2, 4, 6, 3, 7, 9, 10, 1).
9. Programming that copies all characters in the character array S2 to the character array S1 (without the strcpy function).
10. The year of the given years, judging whether the year is a leap years (defining a macro to determine whether the year is a leap).
11. After you enter a single line of lowercase letters, turn the letter into its next letter (A to B, B to C, C to D 、...、 x to Y, y to Z, and Z to a) output.
12. Write a function that handles two-dimensional arrays of n rows and N columns: The elements of each row are divided by the same absolute value on the line.
13. Write the function to find the value of any order polynomial A0+A1X+A2X2+...+ANXN and return the value of the polynomial.
14. Design a function that gives a number of the original code, can get the number of the complement.
15. Write the function to find the number of negative numbers in the whole element of the two-dimensional array of m rows and N columns.
16. Write a function that returns the number of occurrences and occurrences of the most occurrences in an integer group.
17. Make a program, enter the month number, output the month's English month name, requires a pointer array processing.
18. Write a recursive function that outputs the input string in the reverse order of the input.
19. Write a function that, in a one-dimensional array of n elements, counts the number of array elements larger than the neighboring elements and returns the statistics (regardless of a[0] and a[n-1]), requiring a pointer variable instead of an array-famous parameter.
20. Write the function, in the one-dimensional array of n elements, find the maximum value, the minimum value, and transfer to the calling function.
21. Write a function that counts the number of positive numbers, the number of negative numbers, the number of 0, and the statistical results of a two-dimensional array of m rows n columns.
22. Write a function in the given line with "." End of the character, find the longest word and output.
23. Write a function print that prints a student's score array with 5 student data records, each containing a num,name,score[3], enter these records with the main function, and print the records with the printing function.
24. Copy the text file D1.dat to the text file D2.dat, requiring that only the English characters in the D1.dat be copied.
25. Programming, copy the text file D1.dat to D2.dat (where the space character is not copied).
26. Programming, copy the text file D1.dat to D2.dat (where uppercase letters are converted to lowercase letters).
27. Copying the text file D1.dat to a text file D2.dat requires copying only the contents of the D1.dat except for English characters and numbers.
28. Find the prime number between 1 and 100 (only divisible by 1 and itself) and write the file Su.dat sequentially.
29. Disk files A1 and A2, each storing an alphabetical string, programmed to merge two files into the A3 file, the merge remains in alphabetical order (for example, "Accel" in the A1, A2 "Ilrz", the A3 is "Acceillrz").
30. The known sequential file C.DAT holds the test scores for the basis of the program design, each containing a number (8 characters) and a score (three-bit integer) of two data items. To compile a program to read students ' scores from a document, and then to form a new document that is greater than or equal to 60 points SCORE60.DAT saved on a disk, showing the total number of students (less than 1000), average scores and passing numbers.
31. The head is known to point to a one-way list of lead nodes, and each node in the list contains data fields and pointer fields. Please write a program to implement the inverse of the list.
Wakahara Linked lists are:
Head
A
B
C∧
The reverse post list should be:
Head
C
B
A∧
32, the programming function to achieve in a leading node (head) of the unidirectional linked list (data order) to delete the same data nodes (the same data node only one).
33. Compile a program to assign the character computer to a character array and then output the string from the beginning of the first letter interval. Please use the pointer to complete.
34. A program that copies all characters starting with the first character of the string into another string, requires the input of the string and the value of M in the main function, and outputs the copied result, and completes the copy in the called function.
35, there are 4 students each student to take 4 courses, require the user input student number after the output of all the results of the students, with the pointer-type function to achieve. Please write the function float *search ().
Main ()
{static float score[][4]={{60,76,80,90},{45,86,57,90},{58,95,80,71},{78,50,60,85}};
Float search (), p;
int i,m;
printf ("Enter the number of student:");
scanf ("%d", &m);
printf ("The score of No.%dare:\n", M);
P=search (SCORE,M);
for (i=0;i<4;i++)
printf ("%52f\t", * (P+i));
}
Float Search (float (pointer) [4],int N)
{}
36, there are 4 students each student to take 4 courses, require the user to find the students who have failed the course number and output all the results, with pointers to achieve.
37, programming a program to convert the decimal number into a binary number, and stored in a one-dimensional array b, and then output.
38, the function of the following functions of P is to use a recursive method to calculate the value of the N-order de polynomial of X. There is already a call statement P (n,x); write the P function. The recursive formula is as follows:
1
X
PX (X) =
((2n-1) *x* Pn-1 (x)-(n-1) * PN-2 (x)/n
39, the implementation of the following 5*5-order spiral phalanx.
1
2
3
4
5
16
17
18
89
6
15
22
21st
20
7
14
23
24
25
8
13
12
11
10
9
40, programming a program to achieve all not more than 200 of the n value, the square of N is a palindrome with a symmetric nature number. The so-called palindrome number is the same as a number from left to right, and read from Starboard to left, for example, 34543 and 1234321 are palindrome numbers
41. Write a function implementation to store an integer in reverse order into an array.
42, please write a program: Enter a string from the keyboard, the lowercase letters are all converted to uppercase letters, output to the disk file "Upper.txt" to save. Enter the string with "! End
43. A set of integers is stored in the file Number.dat. Please program statistics and output the number of integers, negative integers, and zeros in the file.
44, please program: read from the keyboard a 16-ary unsigned number m, call the function Rightrot the original data in M loop to the right n bits. and output the content before and after the shift.
45. Design a recursive function to calculate the following functions:
PX (x,n) =x-x2+x3-x4+......+ ( -1) n-1xn (n>0)
46, design a recursive function to calculate the n-th square of x.
47, design a recursive function implementation will be less than 32768 integer output in reverse order.
48, design a recursive function implementation will be less than 32768 integer output in reverse order.
49, design a recursive function to implement the following functions:
ACK (m,n) = n+1 when m=0
ACK (m-1,1) when n=0
ACK (M-1,ack (m,n-1)) when n>0,m>0
50, design a recursive function implementation to convey any positive integer to a binary number.
51, design a recursive function implementation to convey any positive integer to the octal number.
52, design a recursive function implementation to convey any positive integer to hexadecimal number.
53, programming to determine the positive and negative of the input integer x and parity.
54, programming to calculate the larger value of two.
55, 55555 of the approximate number of the largest three-bit approximate.
56, enter 10 integers, the positive number of the number and the average, accurate to two decimal places.
57, programming to determine whether to enter a year from the keyboard is a leap years.
58. Enter N value to print the following isosceles triangle with a height of n.
When n=4 the graph is as follows:
*
***
*****
*******
59. Enter an n value to print the following graphic. (e.g. when n=5)
1 2 3) 4 5
1 1 2) 3 4
1 1 1) 2 3
1 1 1) 1 2
1 1 1) 1 1
60, programming the following calculation: (Requires the last item less than 10-3)
sum=1+1/2+1/3+1/4+ ...
61. Write a function to calculate the n-th square of x.
62. The maximum element value of the 3*4 matrix is programmed.
63, write the function, through the pointer to connect two characters. The function header is as follows:
64, write the function, through the pointer to find a string of crossdress. The function header is as follows:
65, write the function, through the pointer to find the length of a string. The function header is as follows:
#include <stdio.h>
Char *strlen (char *s)
{char *p=s;
while (*p) p++;
return (P-S);
}
66. The N (0<n<100) integer elements in array A are sequentially numbered from small to large, requiring that the order of the elements in arrays a cannot be changed, and that the same elements have the same number. For example a= (5,3,4,7,3,5,6) output: (3,1,2,5,1,3,4)
67, input positive integer N (n<1000), produce the corresponding English string and output. For example
1 One
2.
3, three
......
Eleven
135 One handred Trirty FIVE
68, write a program will meet the conditions of the POW (1.05,n) <1e6<pow (1.05,n+1), the N, pow (1.05,n) value in the format "%d,%.0f" written to the current directory of the new file Design.dat.
69, compiling a program statistics to meet the conditions x*x+y*y+z*z==2000 the number of all solutions, and the statistical results in the format "%d" to write to the current directory of the new file Design.dat. Note: If a, B and C are 1 solutions, then A, C and B are also 1 solutions.
70. Compile a program, enter a string from the keyboard, and then output a new string as required. In the new string, a space is inserted between every two characters, as the original string is "ABCD" and the new string is "a B c D". Requires the creation of a new string in the function insert.
71, the test program to determine whether the positive integer input is both 5 and 7 integer times. If so, output yes, otherwise output No.
72, each Apple 0.8 yuan, the first day to buy two apples, starting from the next day, buy twice times the day before, until the number of apples purchased up to not more than 100 of the most. How much does it cost per day to write a program?
73, the test program to find out 1 to 99 of all isomorphism number, so-called isomorphism refers to it appears on the right side of its square number. such as 6 square number 36 So 6 is the isomorphism number.
74. Try writing a program to delete all characters C in the string S.
75, write the procedure, beg 1-3+5+......+101
76, write the procedure, beg e=1+1/1! +1/2! +......+1/n!, requires a value less than 10-4 for the last item
77, write the program, print to form (input a positive integer, output a prism)
When n=4, the graph is as follows:
*
***
*****
*******
*****
***
*
78. Print the following matrix
25
24
23
22
21st
10
9
8
7
20
11
2
1
6
19
12
3
4
5
18
13
14
15
16
17
79, the factorial of any one not more than 100 integers.
80. Implement any addition of no more than 100 bits and two integers.
81, to implement any multiplication of no more than 100 bits and two integers.
82. Use recursion to find all the subsets of n elements.
83, programming to enter five words from the keyboard, please sort them from small to large and then output.
84. Write the function Inxert (s1,s2,f) to insert the string s2 at the specified position F in the string S1.
85. To find such a three-digit number, the three-digit number equals the sum of the factorial of each digit.
86, using recursion to find the full array of n elements.
87, programming output digital rectangle. Enter the length A and width B of the rectangle by the keyboard, placing the following rectangle.
Example: Enter a=3,b=5
Output: 1 2 6
3 5 7
4 8 12
9 11 13
10 14 15
88. An unfinished equation is as follows:
1 () 2 () 3 () 4 () 5 () 6 () 7 () 8 () 9=n
Fill in the +,-or do not fill in the (). Programming to find out the input of an n value (n is an integer, by the keyboard input), so that the equation set up all the scenarios and statistics total. For example: n=108 when there is an equation 123-45+6+7+8+9=108
89, the programming realization complex number's + 、-、 * Three kinds of operation.
90, through the keyboard input a high-precision positive integer n, remove any of the number of S number after the remaining numbers according to the original left and right order partners to form a new positive integer. Programming a given N and S, looking for a scheme that minimizes the number of new numbers that are made up of the remaining digits.
91. Given a certain month of the year, convert it to the first day of the year.
92, in a black bag total N white ball and Black Ball (n>0), there are some white ball outside the bag. Each time a random from the bag to remove the two balls, if the ball out of the same color, then put back a white ball, if the two balls out of different colors, then put back a black ball, until the end (take out the last two balls not put back).
Please program to simulate the ball-taking process and explain the color of the last two balls.
93. Display the characters of the text file and its corresponding ASCII code.
94, known to have two ordered integer files file1 and file2, please program them to merge into a new ordered file.
95. Count the number of occurrences of each word in English. In English, each line is not more than 80 characters, and the words are separated by a space, tab, or carriage return. English is required to be entered on the keyboard and ended by EOF (ctrl+z+ carriage return).
96, the 1 to 9 of the nine are divided into three three digits, requiring the first three digits, is three times the second twice-digit, is three times the third three times-digit number. How should you divide the question?
97, to find out all the possible forms of the formula, each formula has nine numbers, just 1 to 9 of these nine numbers.
(1) 000+000=000 (a total of 168 possible)
(2) 0*0000=0000 (a total of 2 possible)
(3) 00*000=0000 (a total of 7 possible)
(4) 0*000=00*000 (a total of 13 possible)
(5) 0*000=0*0000 (a total of 288 possible)
(6) 00*00=0*0000 (a total of 7 possible)
(7) 00*00=00*000 (a total of 11 possible)
98. Give 8 numbers arbitrarily, and place these 8 on the eight vertices of the cube, requiring that the sum of 4 on each face be equal.
99. Enter a string and create a linked list, each node holds one character and outputs it.
100. Enter a line of string from the keyboard, convert the small to uppercase, and save to the file test.
C Language Introduction 100 questions, the majority of the test algorithm