《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或异常的时候,我们如何调试代码找出问题点.其实在本章之前的章节我们做练习的时候都会遇到各种各样的错语和异常,最初当不知道程序哪里出错的情况下不可否 ...
随机推荐
- YUV422蓝屏显示输出功能辅助调试
YUV422蓝屏显示输出功能辅助调试 YUV422有YUYV,YVYU,UYVY,VYUY四种,以下笔者就就以UYVY为例介绍一下数据构成.因为常常要跟视频输入打交道,所以YUV422这种常见的视频信 ...
- [GIF] GIF Loop Coder - Introduction
Introducing the program, GIF Loop Coder, which allows you to make looping animated gifs (and other t ...
- [Javascript] Create an Array concatAll method
In addition to flat Arrays, programmers must often deal with nested Arrays. For example let's say we ...
- ubuntu卸载qq2012
xianbin@xianbin-ThinkPad-E520:~$ sudo dpkg --purge wine-qq2012-longeneteam [sudo] password for xianb ...
- 齐全的IP地址查询接口及调用方法(转)
设计蜂巢IP地址查询接口:http://www.hujuntao.com/api/ip/ip.php 腾讯IP地址查询接口:http://fw.qq.com/ipaddress 新浪IP地址查询接口: ...
- Android(java)学习笔记143:android提供打开各种文件的API接口:setDataAndType
android 打开各种文件(setDataAndType) private void openFile(File file){ Intent intent = new Intent(); inten ...
- PowerDesigner使用详解
PowerDesign高级应用编写相关的VBS脚本在PowerDesign里自定义一些命令与操作等,具体的可以参考C:\Program Files\Sybase\PowerDesigner 9\VB ...
- Linux下pcapy的安装问题
在安装pcapy包的时候 cd pcapy-0.10.8/ python setup.py install 报错 error trying to exec ‘cc1plus’: execvp: No ...
- C#扫盲之:前台线程后台线程
1.线程分类 线程由程序员创建,可是创建的方式不同,总体来说有两种,一种是个人构造,也就是使用thread类new线程对象创建,这一类线程是大部分程序员知道的,也叫专用线程;还有一种是由CLR创建,这 ...
- Magento Block设计分析(深入分析)
Magento中Block是一个很重要的组件,它在Block中充当非常重要的角色,下面我们来分析一下Magento中Block是怎样设计的,我们应该怎样使用这个重要的角色. 1.Magento Blo ...