# include & ltwindows.h & gt
# include & ltstring.h & gt
# include & ltstdlib.h & gt
# Define Max 1000
void main 1()
{
int a,* p;
p = & ampa;
Printf ("Please enter a number:");
scanf("%d ",p); //enter a value for the address a pointed by p.
printf("a=%d\n*p=%d\n ",a,* p); //Output the value stored at address A, and output the contents of address A pointed by p..
}
void main2()
{
int a,* p;
p = & ampa;
Printf ("Please enter a number:");
scanf("%d ",& ampa); //enter a value for the address a pointed by p.
printf("p=%p *p=%d\n ",p,* p); //The digits with insufficient first address number of A pointed by output P should be filled with 00 to complete the content of address A pointed by output P..
printf("%4d%4d %x\n ",(*p)++, ++(*p),p); //Now output the address pointed by P, the value in the address pointed by P plus 1, and the value in the address pointed by P plus 1 plus 1.
printf("%4d%4d\n "、*p++、* p); //The last program adds 1 and outputs the contents of the address indicated by p..
printf("p=%x\n ",p); //Output the address number that P points to now.
}
void sub(int x,int y,int *z)
{
* z = y-x;
}
void main3()
{
int a,b,c;
sub( 10,5 & amp; a); //Give the rich values of X 10 and 5 respectively, and Y passes the address of A as the rich value of the address of A pointed by Z in the sub.
sub(7,a,& ampb); //Give the values of 7 and A to X respectively, and Y passes the address of B as a *z in the sub, which is rich in the address of B pointed by Z..
Children (a, b, and ampc); //Give the value of A and the value of Bar to X respectively, and Y passes the address of C as a *z in the sub, which is rich in the address of C pointed by Z..
printf("a=%d\nb=%d\nc=%d\n ",a,b,c); //output the specified a b c
}
void main4()
{
int a[] = { 1,2,3,4,5 };
int * p = NULL
p = a; // p points to the first address of a.
printf("%d ",* p); //output the content of the first element of the first address of A pointed by P.
printf("%d ",*(++p)); // p Move the second element pointing to A and output her contents.
printf("%d ",* ++ p); // p Move the second element pointing to A and output her contents.
printf(" % d " ,*(p-)); //The bit to which the output value points after moving forward by one element.
printf("%d ",* p++); //Output the value of p, and then move the point of p backward by one element.
printf("%d ",* p); //output the value of the address pointed to by P shift.
printf(" % d " ,++( * p)); //Add 1 to the address value pointed by p, and output the value.
printf("%d\n ",* p); //Now output the value of the address pointed by p..
}
f(int *t)
{
* t = 10;
}
void main5()
{
int *p,a;
a = 2;
p = & ampa; // p points to the address of a.
f(p); //Pass the address of A pointed by P to *t, and reassign A in the sub-function;
printf("a=%d\n ",a); //output the value redistributed by a.
}
void main6()
{
int a[ 10],j,* p;
for(j = 0; j & lt 10; j++)
a[j]= j+ 1; //assign a value to the array a.
Printf ("\ nuse [j]:\n" output array);
for(j = 0; j & lt 10; j++)
printf("%d ",a[j]); //Output the assigned.
p = a; // p points to the first address of array a.
Printf ("\ nuse p[j]:\n" output array);
for(j = 0; j & lt 10; j++)
printf("%d ",p[j]); //Think of the pointer p as each element of A pointed by an array whose output is p.
Printf ("\ nuse *( p+j):\n) output array);
for(j = 0; j & lt 10; j++)
printf(" % d " ,*(p+j)); //Think of the pointer p as each element of A pointed by an array whose output is p.
Printf ("\ nUse *( a+j):\n) to output the array);
for(j = 0; j & lt 10; j++)
printf(" % d " ,*(a+j)); //use the pointer property of array a.
Printf ("\ nuse *p++ output array: \ n");
for(j = 0; j & lt 10; j++)
printf("%d ",* p++); //Think of the pointer p as each element of A pointed by an array whose output is p.
printf(" \ n ");
}
Void input (float *p, int n)
{
int I;
Printf ("Please enter %d score:", n);
for(I = 0; I & ltn;; i++)
{
scanf("%f ",(p+I));
}
}
Void output (float *q, int n)
{
int I;
Printf ("output score: \ n");
for(I = 0; I & ltn;; i++)
{
printf(" % f \ n " ,*(q+I));
}
}
void FMax(float score[],int n,float *maxs,int *maxn)
{
int I;
* maxs = score[0];
for(I = 1; I & ltn;; i++)
{
if(score[I]& gt; * Max.)
{
* maxs = score[I];
* maxn = I;
}
}
}
Void FMin (floating point fraction [], integer n, floating point * minutes, integer * minutes)
{
int I;
* minutes = score [0];
for(I = 1; I & ltn;; i++)
{
if(score[I]& lt; * minutes)
{
* mins = score[I];
* Minn = I;
}
}
}
void main7()
{
Floating fraction [MAX], maxs, mins
int maxn,minn
Input (score,10);
Output (score,10);
FMax (score, 10,& max, amp maxn);
FMin (score, 10, & min & min);
printf("maxscore=%.2f,\t\tmaxnum=%d\nminscore=%.2f,\t\tminnum=%d\n ",maxs,maxn,mins,Minn);
}
int aver(int (*p)[5],int q)
{
int j,m=0,b;
for(j = 0; j & lt5; j++)
{
m+= *(*(p+q- 1)+j);
}
b = m/5;
Return (b);
}
void main8()
{
int i,j,(*pscore)[5],a,n,q[ 10][5];
PS core = q;
Printf ("Please enter five scores of ten students: \ n");
for(I = 0; I< 10; i++)
{
for(j = 0; j & lt5; j++)
{
scanf("%d ",& ampPS core[I * 5+j]);
}
}
Printf ("Please enter student number:");
scanf("%d ",& ampn);
a=aver(pscore,n);
Printf ("The average of five grades of these %d students is: %d\n", n, a);
}
void main9()
{
char *str 1、*str2、*str3,a[ 100],b[ 100],c[ 100];
str 1 = & amp; a[0];
str2 = & ampb[0];
str3 = & ampc[0];
printf(" str 1 = ");
gets(str 1);
printf(" str 2 = ");
gets(str 2);
strcat(str 1,str 2); //Connect the string str2 to the string str 1.
printf("str 1=%s\n ",str 1); //Output the connected string str 1.
strcpy(str3,str 1); //Connect the string str 1 after the string str3.
printf("str3=%s\n ",str 3); //output the connected string str3.
}
void main 10()
{
char * p = " abcdefghijklmnopq
while( *p++! ='e')// The pointing address of pointer P moves backward by one element to determine whether it is equal to' e'
printf("%c\n ",* p); //If the judgment is equal to' e', the characters in the address pointed by p are output.
}
void main 1 1()
{
Char b[] = "program";
char * a = " PROGRAM
int I = 0;
printf("%c%s\n ",*a,b+ 1); //Add one to array B, then output B, and then output * A..
while (putchar(*(a+i)))
{
i++;
}
printf("i = %d\n ",I); //Judge how many characters A has output.
while ( - i)
{
putchar(*(b+I)); //Invert the p string without outputting the last one.
}
printf("\n%s\n ",& ampb[3]); //output the last four digits of the b string.
}
void main 12()
{
int a= 1,*p,* * pp
pp = & ampp;
p = & ampa;
a++;
printf ("%d,%d,%d\n ",a,*p,* * PP); // a is the value of A plus 1 *P is the value in the pointed A address **pp is pointed *P is the value in the pointed A address.
}
void main 13()
{
char *alpha[7]={ " ABCD "," EFGH "," IJKL "," MNOP "," QRST "," UVWX "," YZ " };
char * * p;
int I;
p =α;
for(I = 0; I<4; i++)
printf(" % c " ,*(p[I]); //The first letter of the first four strings pointed to by the output.
printf(" \ n ");
}
void main 14()
{
char n[ 100];
Char *s []={ "zero", "one", "two", "three", "four", "five", "six", "seven", "eight" and "ten"};
int i,x,len
Printf ("Enter a string of Arabic numerals: \ n");
gets(n);
len = strlen(n); //Calculate the length of input n..
for(I = 0; I & ltleni++)
{
x = *(n+I)-48; /* 48 is the ASCII code of the character "0" */
printf("%s ",s[x]); //Use the entered number as the address number.
}
printf(" \ n ");
}
Unsigned integer MyStrlen(char s[])
{
char * p = s;
while (*p! ='\0' )
{
p++;
}
Return (p-s);
}
void main 15()
{
char a[ 1000];
int b;
Printf ("Number of characters input:");
Get (a);
b = MyStrlen(a);
Printf ("Length of number: %d\n", b);
}
void reading(char (*a)[5],int *num)
{
int I = 0;
Get (a [I]);
And (! strcmp(a[i],* * * *)= = 0)
{
Get (a [I]);
}
* num = I;
}
void findmax(char (*a)[5],int *num,char **max)
{
int I;
For (*max=a[0], I =1; I < * number; i++)
{
if(strcmp(a[i],*max)>0)
* max = a[I];
}
}
void main 16()
{
char ss[ 10][5],* ps
int n;
Reading (SS&; n);
find max(ss & amp; n & amp; PS);
printf("max=%s\n ",PS);
}
int *search 1(int(*s)[4],int *len,int *n)
{
int i,j;
for(I = * n; I<* leni++)
{
for(j = 0; j & lt4; j++)
{
if(*(*(s+I)+j)& lt; 60)
{
* n = I;
return s[I]; //If there is a failed return address.
}
}
}
Return NULL// If you don't return NULL, just type out the students who didn't fail.
}
int *search2(int(*s)[4],int *len,int *n)
{
int i,j;
for(I = * n; I<* leni++)
{
for(j = 0; j & lt4; j++)
{
if(*(*(s+I)+j)& lt; 90)
{
* n = I;
return s[I]; //If there is a failed return address.
}
}
}
Return NULL// If you don't return NULL, just type out the students who didn't fail.
}
void main 17()
{
int i,j,n,score[ 1000][4],count=0,x;
int * p;
P =& Score [0] [0];
Printf ("Please enter the total number of students (less than1000): \ n");
scanf("%d ",& ampn);
Printf ("Please enter the score of each student: \ n");
for(I = 0; I & ltn;; i++)
{
for(j = 0; j & lt4; j++)
{
scanf("%d ",& ampp[I * 4+j]);
}
}
Printf(" 100 please enter 100, 150 please enter150: ");
scanf("%d ",& ampx);
Switch (x)
{
Case 100:
I = 0; //Start with the first one.
While (I & ltn+ 1)
{
P=search 1 (score, & ampn & amp; I);
If (p)// If there is
{
Printf ("The %d individual failed, with three subjects: \n", I+1);
for(j = 0; j & lt4; j++)
{
printf("%d,",* p++);
}
count++; //There are several failed records.
printf(" \ n ");
}
i++;
}
If (! Procter & gamble company. & ampCount==0)// If not,
{
Printf ("No student failed \ n");
}
Break;
Case 150:
I = 0; //Start with the first one.
While (I & ltn+ 1)
{
p=search2(score,& ampn & amp; I);
If (p)// If there is
{
Printf ("The %d individual failed, with three subjects: \n", I+1);
for(j = 0; j & lt4; j++)
{
printf("%d,",* p++);
}
count++; //There are several failed records.
printf(" \ n ");
}
i++;
}
If (! Procter & gamble company. & ampCount==0)// If not,
{
Printf ("No student failed \ n");
}
Break;
Default value:
Printf ("The letter entered is incorrect." );
}
}
# Define MAXI 16
# Define N 5
void sort(char (*s)[MAXI],int n)
{
int i,j;
char * temp =(char *)malloc(sizeof(char)* MAXI);
for(I = 0; I<n-1; i++)
{
for(j = I+ 1; j & ltn; j++)
{
if(strcmp(s[i],s[j])& gt; 0) // The sorting here cannot use s[i] = s[j]. Error: The types in the assignment are incompatible.
{
strcpy(temp,s[I]);
strcpy(s[i],s[j]);
strcpy(s[j],temp);
}
}
}
Free (temporary);
}
void print(char (*s)[MAXI],int n)
{
int I;
for(I = 0; I & ltn;; i++)
{
printf("%s\n ",s[I]);
}
}
void main 18()
{
Int index;
char str[N][MAXI];
For (index = 0; index & ltn; index++)
{
Printf ("Please enter %d string: \n", index+1);
gets(str[index]);
}
sort(str,N);
print(str,N);
}
void main 19()
{
Printf ("\ t \ t \ t \ tWelcome ");
printf(" \ n ");
printf(" \ t \ t * * * * * * * * * * * * * * * * * * * * * *);
printf(" \ n \ t \ t * \ t \ t \ t \ t \ t * ");
printf(" \ n \ t \ t * \ t \ t \ t \ t \ t * ");
Printf(" \ n \ t \ t * \ t \ t tEnter 1. The first experiment \ t \ t * ";;
Printf(" \ n \ t \ t * \ t \ t tEnter 2. Experiment ② \ t \ t * ";
Printf(" \ n \ t \ t * \ t \ t tEnter 3. The third experiment \ t \ t * ";;
Printf(" \ n \ t \ t * \ t \ t tEnter 4. The fourth experiment \ t \ t * ";;
Printf(" \ n \ t \ t * \ t \ t tEnter 5. Experiment 5 ⑤\ t \ t * ";;
Printf(" \ n \ t \ t * \ t \ t tEnter 6. The sixth experiment \ t \ t * ";;
Printf(" \ n \ t \ t * \ t \ t tEnter 7. Experiment ⑦ \ t \ t * ";
Printf(" \ n \ t \ t * \ t \ t tEnter 8. Experiment \ t \ t * ";;
Printf(" \ n \ t \ t * \ t \ t tEnter 9. Experiment 9 ⑨\ t \ t * ";;
Printf(" \ n \ t \ t * \ t \ t tInput 10. Experiment \ t \ t * ";;
Printf(" \ n \ t \ t * \ t \ t tEnter 1 1. Experiment ⑾ \ t \ t * ";
Printf(" \ n \ t \ t * \ t \ t tInput 12. Experiment \ t \ t * ";;
Printf(" \ n \ t \ t * \ t \ t tInput 13. Experiment \ t \ t * ";;
Printf(" \ n \ t \ t * \ t \ t tInput 14. Experiment \ t \ t * ";;
printf(" \ n \ t \ t * \ t \ tEnter 15。 Experiment \ t \ t * ";;
Printf(" \ n \ t \ t * \ t \ t tInput 16. Experiment \ t \ t * ";;
Printf(" \ n \ t \ t * \ t \ t tInput 17. ⒄ th experiment \ t \ t * ";;
Printf(" \ n \ t \ t * \ t \ t tInput 18. Experiment ⒅ \ t \ t * ";
Printf(" \ n \ t \ t * \ t \ t tEnter 0. end \ t \ t * ";
printf(" \ n \ t \ t * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \ n ");
}
void main()
{
int n,m;
Do {
System ("CLS");
main 19();
Printf ("Please enter the serial number of the program you want to run:");
scanf("%d ",& ampn);
Switch (n)
{
Case 1:
main 1();
Break;
Case 2:
main 2(); Break;
Case 3:
main 3(); Break;
Case 4:
main 4(); Break;
Case 5:
main 5(); Break;
Case 6:
main 6(); Break;
Case 7:
main 7(); Break;
Case 8:
main 8(); Break;
Case 9:
main 9(); Break;
Case 10:
main 10(); Break;
Case 1 1:
main 1 1(); Break;
Case 12:
main 12(); Break;
Case 13:
main 13(); Break;
Case 14:
main 14(); Break;
Case 15:
main 15(); Break;
Case 16:
main 16(); Break;
Case 17:
main 17(); Break;
Case 18:
main 18(); Break;
Default value:
Printf ("Wrong choice! ! ! ! ! ! ! \ n ");
}
Printf ("I don't want to enter 0 or any number:");
scanf("%d ",& ampm);
}while(m! =0);
}