C language: Use the parameters of the main function to implement an integer computer.
# Include # include # include int calculator (int num1, char * p, int num2) {if (p = "-a") return num1 + num2; else if (p = "-s") return num1-num2; else if (p =
Replacement of String Array spaces in C LanguageProblem description: String Replacement space: implement a function to replace each space in the string with "% 20 ". For example, if "we are happy." Is input, "we % 20are % 20happy." Is output .".
C language: Uses Bubble sorting to sort multiple strings (optimized ).
# Define _ CRT_SECURE_NO_WARNINGS 1 # include # include # include int main () {char * str [] = {"hello", "change", "world", "come", "on"}; // pointer array, each is a
C language: how to optimize the sorting of a group by the bubble method?
# Define _ CRT_SECURE_NO_WARNINGS 1 # include # include int main () {int arr [] = {5, 6, 7, 8, 9, 1, 2, 3, 4}; int I = 0; int j = 0; int flag; int size = sizeof (arr)/sizeof
Bitwise OR of C LanguageSymbol: ^ returns an exclusive bitwise OR. Rule: The same is zero, and the difference is one. For example, only one number appears in a group of data. All other numbers are paired. Find this number. (Using bitwise operations)
The most powerful of C language-pointerPointers are inseparable from addresses. When we mention pointers, we should think of addresses, because in C language, the value of pointer variables is an address. With this value, it can point to the memory
Enable "mentally retarded" board games in C Language
# Define _ CRT_SECURE_NO_WARNINGS # include # include /* function declaration */void Init_Arr (int arr [] [3]); // array initialization void Print_Checkerboard (int arr [] [3]); // print the
[C Language] Left-hand string
To implement a function, you can use k characters in the left-hand string. Method 1: open another array and write the characters After k + 1 into this array first, write the k characters to be left-handed as follows: #
The first guess digital game in C Language
# Include # include # include # include # include # include # include void output () {printf *********** * *********** \ n "); printf ("********************** enter 1 to enter the guess digital game *
Objective-C -- Category
Encapsulation is a feature of object-oriented, and OC is no exception, but sometimes we will encounter such a situation. For example, I encapsulate a class and don't want to change it any more, however, as the program
C monkey eat peachThe monkey has a peach problem. On the first day, the monkey picked several peaches and immediately ate half of them. They were so addicted that they ate another one. The next morning, I ate another half of the remaining peaches,
Implementation of simple physics problems in C LanguageProblem: A ball falls freely from a 100-meter-tall place. After each landing, it jumps back to half of the original height, then drops, and then rebounds. Ask how many meters a total of 10th
[C Language] implement strstr Functions
# Include # include char * my_strstr (const char * str1, const char * str2) {assert (str1); assert (str2); char * p = str1; // record the initial position of str1 char * s1 = p; // record the initial
C language. Enter multiple lines of information on the terminal to find the lines containing the "could" and print and modify the lines.
# Define _ CRT_SECURE_NO_WARNINGS 1 # include # include # include # define MAX 1000int getline (char * line,
A simple three-game (implemented in C)The question is: in a 3*3 matrix, the chess party has three consecutive sub-members and the winning code is as follows:
# Include # include # include char arr [3] [3] = {0}; // All functions that directly
C function implementation to determine whether a number is a prime number
# Include # include # define YES 1 # define NO 0 void main () {int n; int Prime_num (int n); // declare the Prime_num function printf ("please enter a number: "); scanf (" %
The decimal rounding method is as follows:
Recently, I found that there was a problem with the code rounded down. I checked the information on the network and recorded the information for future query.
Principle: enlarge the data, and then use the
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.