《C和指针》章节后编程练习解答参考——第10章
10.1
#include <stdio.h> typedef struct
{
unsigned char QuHao[];
unsigned char Exchange[];
unsigned char StnNum[];
}TelphoneNumber; typedef struct
{
unsigned char date[];
unsigned char time[];
TelphoneNumber UserTelphone;
TelphoneNumber CallTelphone;
TelphoneNumber PayTelphone;
}Telphone_Call; int main (void)
{ getchar();
return ;
}
10.2
#include <stdio.h> #define NAMELENGTH 21
#define ADDRLENGTH 41
#define MODLLENGTH 21
#define NAMEOFBANKLEN 21 typedef struct
{
float ManufacturerSuggestedRetailPrice;
float ActualSellingPrice;
float SalesTax;
float LicensingFee;
}CashSale; typedef struct
{
float ManufacturerSuggestedRetailPrice;
float ActualSellingPrice;
float DownPayment;
float SecurityDeposit;
float MonthlyPayment;
int LeaseTerm;
}Rent; typedef struct
{
float ManufacturerSuggestedRetailPrice;
float ActualSellingPrice;
float SalesTax;
float LicensingFee;
float DownPayment;
int LoanDuration;
float InterestRate;
float MonthlyPayment;
char NameOfBank[NAMEOFBANKLEN];
}LoanSale; typedef struct
{
char CustomerName[NAMELENGTH];
char CustomerAddr[ADDRLENGTH];
char Model[MODLLENGTH];
CashSale CashSal;
Rent RentSal;
LoanSale LoanSal;
}SaleRecord; int main (void)
{ getchar();
return ;
}
10.3
#include <stdio.h> typedef struct
{
unsigned int dst_reg : ; //0-2
unsigned int dst_mode : ; //3-5
unsigned int opcode : ; //6-15
}SingleOperat; typedef struct
{
unsigned int dst_reg : ; //0-2
unsigned int dst_mode : ; //3-5
unsigned int src_reg : ; //6-8
unsigned int src_mode : ; //9-11
unsigned int opcode : ; //12-15
}DoubleOperat; typedef struct
{
unsigned int offset : ; //0-7
unsigned int opcode : ; //8-15
}Branch; typedef struct
{
unsigned int dst_reg : ; //0-2
unsigned int dst_mode : ; //3-5
unsigned int src_reg : ; //6-8
unsigned int opcode : ; //9-15
}RegistSrc; typedef struct
{
unsigned int opcode :; //0-15
}MiscCmd; typedef struct
{
unsigned short addr;
SingleOperat sgl_op;
DoubleOperat dbl_op;
Branch branch;
RegistSrc reg_src;
MiscCmd misc;
}machine_inst; machine_inst x; int main (void)
{ getchar();
return ;
}
《C和指针》章节后编程练习解答参考——第10章的更多相关文章
- 《C和指针》章节后编程练习解答参考——第5章
5.1 题目: 略 解答代码: #include <stdio.h> int main(void) { char ch; while (((ch = getchar()) != EOF) ...
- 《C和指针》章节后编程练习解答参考——第9章
9.1 #include <stdio.h> #include <ctype.h> #include <string.h> #define N 100 int ma ...
- 《C和指针》章节后编程练习解答参考——第8章
8.1 #include <stdio.h> int main (void) { int a, b, c, d; // 不使用嵌套花括号初始化 unsigned ][][][] = { , ...
- 《C和指针》章节后编程练习解答参考——6.2
<C和指针>——6.2 题目: 编写一个函数,删除源字符串中含有的子字符串部分. 函数原型: int del_substr(char *str, char const *substr); ...
- 《C和指针》章节后编程练习解答参考——6.3
<C和指针>——6.3 题目: 编写一个函数,把参数字符串中的字符反向排列. 函数原型: void reverse_string(char *string); 要求: 使用指针而不是数组下 ...
- 《C和指针》章节后编程练习解答参考——6.6
<C和指针>——6.6 题目: 在指定的下限.上限之间使用数组方法查找质数,并将质数提取出来. 要求: 略 解答代码: #include <stdio.h> #define U ...
- 《C和指针》章节后编程练习解答参考——6.4
<C和指针>——6.4 题目: 质数是只能被1和本身整除的整数. 在1到1000之间的质数,在数组中剔除不是质数的数. 解答代码: #include <stdio.h> #de ...
- 《C和指针》章节后编程练习解答参考——6.1
<C和指针>——6.1 6.1 题目: 编写一个函数,在一个字符串中进行搜索,查找另一子字符串中出现的字符. 函数原型如下: char *find_char(char const *sou ...
- python编程快速上手之第10章实践项目参考答案
本章主要讲了python程序的调试,当程序有BUG或异常的时候,我们如何调试代码找出问题点.其实在本章之前的章节我们做练习的时候都会遇到各种各样的错语和异常,最初当不知道程序哪里出错的情况下不可否 ...
随机推荐
- C socket demo
一.服务端-server.c #include <stdio.h> #include <sys/socket.h> #include <arpa/inet.h> # ...
- 在cocos2d-x中使用位图字体
http://blog.csdn.net/fansongy/article/details/9006677 通常情况下,游戏中绚丽的文字和数字都不是字体生成的而是"贴"上去!今天, ...
- 安卓蓝牙技术Bluetooth使用流程(Bluetooth详解)
一:蓝牙设备之间的通讯首要包含了四个进程 设置蓝牙设备 寻觅局域网内也许或许匹配的设备 衔接设备 设备之间的数据传输 二:详细编程完结 1. 发动蓝牙功用 首要经过调用静态办法getDefaultAd ...
- javascript进击(七)Ajax
AJAX AJAX = Asynchronous JavaScript and XML(异步的 JavaScript 和 XML). AJAX 不是新的编程语言,而是一种使用现有标准的新方法. AJA ...
- apache性能配置优化
最近在进行apache性能优化设置.在修改apache配置文件之前需要备份原有的配置文件夹conf,这是网站架设的好习惯.以下的apache配置调优均是在red had的环境下进行的. httpd相关 ...
- ReadWriteLock与ReentrantReadWriteLock
JAVA的JUC包中的锁包括"独占锁"和"共享锁".JUC中的共享锁有:CountDownLatch.CyclicBarrier.Semaphore.Reent ...
- Redis操作Set工具类封装,Java Redis Set命令封装
Redis操作Set工具类封装,Java Redis Set命令封装 >>>>>>>>>>>>>>>>& ...
- ecshop在PHP 5.4以上版本各种错误问题处理
在php5.4版本之后有很多的函数与功能进行丢弃与升级功能了,现在国内很多CMS都还未按php5.4标准来做了,下面我整理了一些在ecshop在PHP 5.4以上版本各种错误问题处理. 1.PHP 5 ...
- String sql = "update web_admin set adminname=? ,password=? where id=?;怎么给“?” 传值?
PreparedStatement pstmt = con.prepareStatement("UPDATE EMPLOYEES ...
- 关于ContentProvider的批量操作
今天看公司代码,发现在批量插入通话记录和联系人的时候,用了一个 ArrayList<ContentProviderOperation> ops = new ArrayList<Con ...