《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或异常的时候,我们如何调试代码找出问题点.其实在本章之前的章节我们做练习的时候都会遇到各种各样的错语和异常,最初当不知道程序哪里出错的情况下不可否 ...
随机推荐
- jitsi
http://code.csdn.net/openkb/p-Jitsi https://download.jitsi.org/jitsi/nightly/ https://download.jitsi ...
- requestFocusFromTouch , requestFocus
/*if(userNameEditText.isInTouchMode()){ userNameEditText.requestFocusFromTouch(); }else{ userNameEdi ...
- “:Choose a destination with a supported architecture in order to run on this device.”
我在编译从GitHub上clone下来的<TweeJump>时,出现如下错误:":Choose a destination with a supported architectu ...
- gdb调试程序
一.准备好内容vim test3.c 输入如下即可 #include <stdio.h> int func(int n) { int sum=0,i; f ...
- 读写应用程序数据-CoreData
coreData数据最终的存储类型可以是:SQLite数据库.XML.二进制.内存里.自定义的数据类型. 和SQLite区别:只能取出整个实体记录,然后分解,之后才能得到实体的某个属性. 1.创建工程 ...
- SpringMVC——项目启动时从数据库查询数据
SpringMVC项目中遇到这样的问题: 1.很多数据字典需要从数据库中查询: 2.懒得修改SQL语句: 3.想在项目中声明静态变量存储数据字典,但是希望这个字典可以在项目启动时进行加载. 当遇到这样 ...
- Linux screen命令简介
Linux上有的shell脚本运行时候是阻塞的,如果想在屏幕上即能够看到阻塞命令的输出,同时又能够在shell窗口运行其他程序,那么Linux自带的screen命令是非常不错的选择. 1.screen ...
- Insert后返回自动插入的生成的ID:select @@identity
当运行完插入语句后,执行select @@identity就可得到自动生成的id 如果是sql server 最好用:select SCOPE_IDENTITY() as id因为@@identity ...
- SWFObject2.0
PROBLEM: using % in the height and width(e.g. 100%) with the SWFObject 2.0 (or 2.1) with dynamic pub ...
- 深入理解C#中this/partial/null的使用
一.this关键字作用 1.this表示当前运行中的对象 Eg: public class Person { public int age; public string name; public Pe ...