Reference for programming exercises after Chapter C and pointer -- Chapter 10th and Chapter 10th of Chapter c and pointer

Source: Internet
Author: User

Reference for programming exercises after Chapter C and pointer -- Chapter 10th and Chapter 10th of Chapter c and pointer

10.1

 

 1 #include <stdio.h> 2  3 typedef struct  4 { 5     unsigned char QuHao[5]; 6     unsigned char Exchange[10]; 7     unsigned char StnNum[10]; 8 }TelphoneNumber; 9 10 typedef struct 11 {12     unsigned char date[10];13     unsigned char time[10];14     TelphoneNumber    UserTelphone;15     TelphoneNumber    CallTelphone;16     TelphoneNumber    PayTelphone;17 }Telphone_Call;18 19 int main (void)20 {21 22     getchar();23     return 0;24 }

 

 

10.2

 

 1 #include <stdio.h> 2  3 #define    NAMELENGTH    21 4 #define    ADDRLENGTH    41 5 #define    MODLLENGTH    21 6 #define NAMEOFBANKLEN    21 7  8 typedef struct 9 {10     float    ManufacturerSuggestedRetailPrice;11     float    ActualSellingPrice;12     float    SalesTax;13     float    LicensingFee;14 }CashSale;15 16 typedef struct17 {18     float    ManufacturerSuggestedRetailPrice;19     float    ActualSellingPrice;20     float    DownPayment;21     float    SecurityDeposit;22     float    MonthlyPayment;23     int        LeaseTerm;24 }Rent;25 26 typedef struct27 {28     float    ManufacturerSuggestedRetailPrice;29     float    ActualSellingPrice;30     float    SalesTax;31     float    LicensingFee;32     float    DownPayment;33     int        LoanDuration;34     float    InterestRate;35     float    MonthlyPayment;36     char    NameOfBank[NAMEOFBANKLEN];37 }LoanSale;38 39 typedef struct40 {41     char    CustomerName[NAMELENGTH];42     char    CustomerAddr[ADDRLENGTH];43     char    Model[MODLLENGTH];44     CashSale    CashSal;45     Rent        RentSal;46     LoanSale    LoanSal;47 }SaleRecord;48 49 int main (void)50 {51 52     getchar();53     return 0;54 }

 

 

10.3

 

 1 #include <stdio.h> 2  3 typedef struct 4 { 5     unsigned int    dst_reg        : 3;    //0-2 6     unsigned int    dst_mode    : 3;    //3-5 7     unsigned int    opcode        : 10;    //6-15 8 }SingleOperat; 9 10 typedef struct11 {12     unsigned int    dst_reg        : 3;    //0-213     unsigned int    dst_mode    : 3;    //3-514     unsigned int    src_reg        : 3;    //6-815     unsigned int    src_mode    : 3;    //9-1116     unsigned int    opcode        : 4;    //12-1517 }DoubleOperat;18 19 typedef struct20 {21     unsigned int    offset        : 8;    //0-722     unsigned int    opcode        : 8;    //8-1523 }Branch;24 25 typedef struct26 {27     unsigned int    dst_reg        : 3;    //0-228     unsigned int    dst_mode    : 3;    //3-529     unsigned int    src_reg        : 3;    //6-830     unsigned int    opcode        : 7;    //9-1531 }RegistSrc;32 33 typedef struct34 {35     unsigned int    opcode        :16;    //0-1536 }MiscCmd;37 38 typedef struct39 {40     unsigned short    addr;41     SingleOperat    sgl_op;42     DoubleOperat    dbl_op;43     Branch            branch;44     RegistSrc        reg_src;45     MiscCmd            misc;46 }machine_inst;47 48 machine_inst    x;49 50 int main (void)51 {52 53     getchar();54     return 0;55 }

 

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.