C Language Blog Job--structure

Source: Internet
Author: User

First, the PTA Experiment Assignment Topic 1: Calculates two complex numbers the product 1. PTA Submission List

2. Design Ideas
struct complex{    int real;    int imag;};//该结构体表示复数的实部和虚部  定义变量z表示结构变量  计算实部;  计算虚部;  返回z;
3. Code

4. Problems encountered in debugging process and PTA Submission List situation description.
    • At first, it is simple to do the complex between the real and the real part of the operation, later only to understand the bashi to take apart, do the corresponding operation.
Topic 2: Calculating Workers ' wages by 1. PTA Submission List

2. Design Ideas
struct p{    char name[10];    float moneyj,moneyf,moneyz,moneys;};//该结构体表示职工的名字,基本工资,浮动工资,支出和实发工资  定义变量i,z;  输入n;  定义结构变量a[n];  for i=0 to i<n    输入n位职员姓名,基本工资,浮动工资,支出;    实发工资=基本工资+浮动工资-支出;  for i=0 to i<n    输出每位职员姓名,实发工资;
3. Code

4. Problems encountered in debugging process and PTA Submission List situation description.
    • No
Topic 3: Entry and display of contacts 1. PTA Submission List

2. Design Ideas
struct f{    char name[11];    char birthday[11];    cahr sex;    char gh[17],sj[17];};//该结构体表示朋友的名字,生日,性别,固话,手机  定义变量i,k,m,n;  定义结构变量a[11];  输入n;  for i=0 to i<n    输入n位朋友姓名,生日,性别,固话,手机;  输入k  定义b[k];  for i=0 to i<k    输入b[i];  for i=0 to i<k    如果b[i]>=0并且b[i]<n            m=b[i];            输出a[m]的姓名,固话,手机,性别,生日;    否则输出Not Found
3. Code

4. Problems encountered in debugging process and PTA Submission List situation description.
    • A single character is entered with a space.
Second, this week's topic set PTA Final Ranking

Third, read the code
    • Tibetan Head Poems

      #include <stdio.h>char *ch(char s[][2000],char t[]);int main(){char s[100][2000],t[1000],*p=NULL;int i;for(i=0;i<4;i++)    scanf("%s",&s[i][2000]);p=ch(s,t);printf("%s\n",p);return 0;}char *ch(char s[][2000],char t[]){int j;for(j=0;j<4;j++){    t[2*j]=s[j+1][0];    
    • Code function is to take out each sentence of the first character string output, the advantage is to use the pointer to address, more efficient.
    • BCD decryption

      #include <stdio.h>int mian(){int x;int n,a;scanf("%d",&x);a=x%16;n=((n/16)%16*10+a);printf("%d\n",n);return 0;}
    • Just a few lines of code to complete the decimal to hexadecimal, the code is concise and clear.

Iv. Study Summary of the Week 1. Summarize what you learned this week.
    • A struct is a collection of data consisting of a series of data of the same type or different types, defined in the formstruct 结构名{ 类型名 结构成员1;类型名 结构成员2;···类型名 结构成员n; };
    • A common body is a construction data type that stores different types of data items in the same paragraph, which can save a great amount of memory space.
    • An enum is a collection in which the elements in the collection are named constants, and the default value of the first enumeration member is 0, and the value of the subsequent enumeration member is added 1 on the previous member, and the enumeration member can be assigned its own value.
    • Recursive functions are based on recursive exits and recursive formulas, and then return the results by a series of calls.
2. List some of the wrong questions this week

    • The recursive function of the preview is not enough to understand, the principle is not clear

C Language Blog Job--structure

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.