struct STeleNum
{
long lAreaNum; // 区号
long lSwitchBoard; // 交换台
long lStationNum; // 站号码
};
struct STeleInfo
{
char *pchDate; // 日期
char *pchTime; // 时间
struct STeleNum UsedNum; // 三个电话号码-使用的那个电话
struct STeleNum CalledNum; // 三个电话号码-呼叫的那个电话
struct STeleNum PayNum; // 三个电话号码-付账的那个电话
};
struct SInFull // 全额
{
float fRetail; // 生产厂家建议零售价(manufacturer’s suggested retailprice) float
float fActual; // 实际售出价格(actual selling price) float
float fTax; // 营业税(sales tax) float
float fLicenseFee; // 许可费用(licensing fee) float
};
struct SRent // 租赁
{
float fRetail; // 生产厂家建议零售价(manufacturer’s suggested retailprice) float
float fActual; // 实际售出价格(actual selling price) float
float fDownPayment; // 预付定金(down payment) float
float fSecurityDep; // 安全抵押(security deposit) float
float fMonthlyPay; // 月付金额(monthly payment) float
int iLeaseTerm; // 租赁期限(lease term) int
};
struct SLoan // 贷款
{
float fRetail; // 生产厂家建议零售价(manufacturer’s suggested retailprice) float
float fActual; // 实际售出价格(actual selling price) float
float fTax; // 营业税(sales tax) float
float fLicenseFee; // 许可费用(licensing fee) float
float fDownPayment; // 预付定金(doun payment) float
int iLoanDuration; // 贷款期限(loan duration) int
float fInterestRate; // 贷款利率(interest rate) float
float fMonthlyPay; // 月付金额(monthly payment) float
char chBankName[21]; // 银行名称(name of bank) string(20)
};
struct SCarSale
{
char chCustomerName[21]; // 顾客名字(customer’s name) string(20)
char chCustomerAddr[41]; // 顾客地址(customer’s address) string(40)
char chMode[21]; // 模型(model) string(20)
int iType; // 三种不同类型的交易:1-全额现金销售、2-贷款销售和3-租赁。
struct SInFull fullFee;
struct SRent rentFee;
struct SLoan loanFee;
};
#include <stdio.h>
#include <stdlib.h>
struct SSingleCmd // 单操作数指令
{
unsigned short dst_reg; // 0-2
unsigned short dst_mode; // 3-5
unsigned short opcode; // 6-15
};
struct SDoubleCmd // 双操作数指令
{
unsigned short dst_reg; // 0-2
unsigned short dst_mode; // 3-5
unsigned short src_reg; // 6-8
unsigned short src_mode; // 9-11
unsigned short opcode; // 12-15
};
struct STransferCmd // 转移指令
{
unsigned short offset; // 0-7
unsigned short opcode; // 8-15
};
struct SSourceRegCmd // 源寄存器指令
{
unsigned short dst_reg; // 0-2
unsigned short dst_mode; // 3-5
unsigned short src_reg; // 6-8
unsigned short opcode; // 9-15
};
struct SOtherCmd // 其余指令
{
unsigned short opcode; // 0-15
};
/*
表达式 位
x.addr 0-15
x.misc.opcode 0-15
x.branch.opcode 8-15
x.sgl_op.dst_mode 3-5
x.reg_src.src_reg 6-8
x.dbl__op.opcode 12-15
*/
struct SMachineInst
{
unsigned short addr; // addr 0-15
struct SOtherCmd misc; // opcode 0-15
struct STransferCmd branch; // opcode 8-15
struct SSingleCmd sgl_op; // dst_mode 3-5
struct SSourceRegCmd reg_src; // src_reg 6-8
struct SDoubleCmd dbl__op; // opcode 12-15
};
typedef struct SMachineInst machine_inst;
int main()
{
machine_inst x;
system("pause");
return EXIT_SUCCESS;
}