2018 on C language Programming (Advanced) Jobs-3rd time jobs

Source: Internet
Author: User

6-1 output Month English name design idea 1, algorithm

The first step: look at the function, see the function declaration
Step Two: Understanding Analysis

2, the flowchart is as follows code
char *a[12][15]={"January","February","March","April","May","June","July","August","September","October","November","December"}; char *getmonth( int n ){  int i;  for(i=1;i<=12;i++)  {    if(i==n)    {      return a[i-1];    }  }  return NULL;  }
Error

No

6-2 Find Week design ideas: 1, algorithm 2, flowchart code
char *a[][15]={"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"};int getindex( char *s )  int i;  for(i=0;i<7;i++)  {    if(strcmp(s,a[i])==0)    return i;  }  return -1;}
Error

No

6-3 calculation of the longest string length design idea algorithm 2, flowchart experiment Code
int max_len( char *s[], int n ){  int i,max=0,t=0;  max=strlen(s[0]);  for(i=1;i<n;i++)  {     t=strlen(s[i]);     if(max<t)     max=t;  }  return max;}
Error

No

The design idea of student's achievement chain List 1, algorithm 2, flowchart experiment Code
#include <string.h>struct stud_node *createlist () {struct Stud_node *p, *ptr, *head=null;    int num;    Char name[20];    int score;    scanf ("%d", &num);        while (num! = 0) {scanf ("%s%d", name,&score);        p = (struct Stud_node *) malloc (sizeof (struct stud_node));        P->num = num;        strcpy (p->name, name);        P->score = score;        P->next = NULL;        if (head = = NULL) {head = p;        } else {ptr->next = p;        } ptr = P;    scanf ("%d", &num); } return head;    struct Stud_node *deletelist (struct stud_node *head, int min_score) {struct Stud_node *ptr1, *ptr2;        while (head! = NULL && Head->score < min_score) {ptr2 = head;        Head = head->next;    Free (PTR2);    } if (head = = NULL) return null;    PTR1 = head;    PTR2 = head->next; while (ptr2! = NULL) {if (Ptr2->score < MIN_SCOre) {Ptr1->next = ptr2->next;        Free (PTR2);        } else Ptr1 = PTR2;    PTR2 = ptr1->next; } return head;
Error

No

Design idea of singular value node list 1, algorithm 2, flowchart experiment Code
struct ListNode *readlist () {struct ListNode *head=null,*p=null,*tail=null;  int data;  scanf ("%d", &data);    while (data!=-1) {p= (struct ListNode *) malloc (sizeof (struct listnode));    p->data=data;    p->next=null;    if (head==null) {head=p;    }else {tail->next=p;    } tail=p;  scanf ("%d", &data); } return head;    struct ListNode *getodd (struct ListNode **l) {struct ListNode *p=*l,*a,*b,*head1,*head2,*p1=null,*p2=null;    head1= (struct listnode*) malloc (sizeof (struct listnode));    head2= (struct listnode*) malloc (sizeof (struct listnode));    head1->next=null;    head2->next=null;    A=head1;    B=head2;          for (;p!=null;p=p->next) {if (p->data%2!=0) {if (p1==null) p1=p;            else a->next=p;        c=2;          } else {if (p2==null) p2=p;            else b->next=p;        B=p;    }} a->next=null; B->next=nulL    *L=P2;  return p1;}
Error

No

Summarize

Learned the level two pointer, but do not understand, a lot of flowchart still do not get.

2018 on C language Programming (Advanced) Jobs-3rd time jobs

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.