2018 on C language Programming (Advanced) jobs-1th time jobs

Source: Internet
Author: User
Tags function definition

A. 6-1 calculates the difference between the two number and the

1. Design ideas:

1) Read the topic carefully and make sure the information is known;

2) Clarify ideas, organize the answers;

3) output submission;

4) The flowchart is as follows:

2. The experiment code is as follows:

Viod Sum_diff (float op1,float op2,float *pusm, float **pusm=op1+  *pdiff=op1-op2;}

3. Problems encountered during commissioning and solutions

The main function definition added ";", at that time for convenience is in the topic of the interface definition pasted over, did not pay attention to the back of a semicolon.

6-2 splitting the integer and fractional parts of a real number

1. Design ideas:

1) Read the topic carefully and make sure the information is known;

2) Clarify ideas, organize the answers;

3) output submission;

4) The flowchart is as follows:

2. The experiment code is as follows:

int int int int x) {  int  i;    for (i=0; i<n;i++)  {    if(list[i]==x)    return  i;  }   return -1;}

3. Problems encountered during commissioning and solutions:

No

Two. 6-1 find the specified element in the array

1. Design ideas:

2. The experiment code is as follows:

int int int int x) {    int  i;      for (i=0; i<n;i++)    {        if(list[i]==x)        {            return  i;        }    }     return -1;}

3. Problems encountered during commissioning and their solutions

No

6-2. Find the maximum value and its coordinates

1. The flowchart is as follows:

2. The experiment code is as follows:

int Fun (int *a,int *b,int  n) {    int  i;     int max=a[0];      for (i=0; i<n;i++)    {        if(max<a[i])        {            max=a[i];             *b=i;        }    }     return Max;}

3. Problems encountered during commissioning and their solutions

Three. After 6-1 min. Before the maximum number of places

1. Design ideas:

2. The experiment code is as follows:

voidInputint*arr,intN) {    inti;  for(i=0; i<n;i++) {scanf ("%d",&Arr[i]); }}voidMax_min (int*arr,intN) {    inti,max,m1,min,m2,t; Max=arr[0],m1=0, min=arr[0],m2=0;  for(i=0; i<n;i++)    {        if(max<Arr[i]) {Max=Arr[i]; M1=i; }        if(min>Arr[i]) {min=Arr[i]; M2=i; }} t=arr[m1];arr[m1]=arr[n-1];arr[n-1]=T; T=arr[m2];arr[m2]=arr[0];arr[0]=t;}voidOutputint*arr,intN) {    inti;  for(i=0; i<n;i++) {printf ("%3d", Arr[i]); }}

3. Problems encountered in the commissioning process and their solutions

6-2 ordering by pointer selection

1) Design ideas:

2) The experiment code is as follows:

 void  sort (int  *x,int   n" { int   max,m,i,j,t;  for  (I=0 ; I<n-1 ; I++ =x[i],m=i;  for  (J=i+1 ; J<n;j++ if  (Max<x                [j]) {max  =x[j];            M  =J;    }} t  =x[m];x[m]=x[i];x[i]=t; }}

3) problems encountered in the commissioning process and their solutions

Four, 6-1 judgment palindrome string

1. Method of thinking:

1)

2) The flowchart is as follows:

No

2. The experiment code is as follows:

BOOLPalindrome (Char*s) {    inti,n,k,j; N=strlen (s); I=0, j=n-1;  for(i=0, j=n-1; i<j;i++,j--)  {    if(s[i]!=S[j]) {       Break; }  }  if(i<j)return false; Else  return true;}

3. Problems encountered in the commissioning process and their solutions

A lot

6-2 using a function to implement a partial copy of a string

1. Design ideas:

2. Flowchart: Will not get

3. The experiment code is as follows:

 void  strmcpy (char  *t, int  m, char  *s) { 
   
    int  
     I,j,n;    strcpy (S, t);      n  =
     strlen (s);  
    for  (I=m-
    1 ; I>
    0 ; I--
    ) { 
    for  (j=i;j <n;j++
    ) {s[j -
    1 ]=
    s[j";  }} s[n -m+
    1 ]=
     " 
    \0  
    "  
    ; }
   

V. Summary OF Knowledge:

The flowchart is not very good, there may be errors, there are a few other flow chart will not get. PTA is very difficult for me a subject, the first semester is a reluctant clearance, the second semester to add strength.

Vi. charts

Date Blog Code
3.11 No. 0 Time Assignment 0
3.16 0 0
3.17 0 0
3.18 0 0
3.19 0 0
3.20 0 0
3.21 0 0
3.22 0 0
3.23 0 0
3.24 0 0
3.25 First time job 0

---restore content ends---

2018 on C language Programming (Advanced) jobs-1th time jobs

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.