附带几个位运算有关的网站: |
||
http://www.cppblog.com/aqazero/archive/2012/11/10/8284.html(c语言优先级列表,这表太好了, 做题目的时候忘记的不懂都来翻一下,感觉慢慢都要记住了。。额) |
||
http://www.cnblogs.com/graphics/archive/2010/06/21/1752421.h(只能说,没看到这个之前,,,, 不,看到这个之后,瞬间惊呆了,算法的魅力吧。) |
||
http://blog.sina.com.cn/s/blog_66ad7bba0100hf9k.html(一些有意思的位运算技巧) | ||
/* | ||
* CS:APP Data Lab | ||
* | ||
* bits.c - Source file with your solutions to the Lab. | ||
* This is the file you will hand in to your instructor. | ||
* | ||
* WARNING: Do not include the <stdio.h> header; it confuses the dlc | ||
* compiler. You can still use printf for debugging without including | ||
* <stdio.h>, although you might get a compiler warning. In general, | ||
* it's not good practice to ignore compiler warnings, but in this | ||
* case it's OK. | ||
*/ | ||
#include "btest.h" | ||
#include <limits.h> | ||
/* | ||
* Instructions to Students: | ||
* | ||
* STEP 1: Fill in the following struct with your identifying info. | ||
*/ | ||
team_struct team = | ||
{ | ||
/* Team name: Replace with either: | ||
Your login ID if working as a one person team | ||
or, ID1+ID2 where ID1 is the login ID of the first team member | ||
and ID2 is the login ID of the second team member */ | ||
"SA15226245+SA15226240", | ||
/* Student name 1: Replace with the full name of first team member */ | ||
"杨宗明", | ||
/* Login ID 1: Replace with the login ID of first team member */ | ||
"SA15226***", | ||
/* The following should only be changed if there are two team members */ | ||
/* Student name 2: Full name of the second team member */ | ||
"周子翔", | ||
/* Login ID 2: Login ID of the second team member */ | ||
"SA15226***" | ||
}; | ||
#if 0 | ||
/* | ||
* STEP 2: Read the following instructions carefully. | ||
*/ | ||
You will provide your solution to the Data Lab by | ||
editing the collection of functions in this source file. | ||
CODING RULES: | ||
Replace the "return" statement in each function with one | ||
or more lines of C code that implements the function. Your code | ||
must conform to the following style: | ||
int Funct(arg1, arg2, ...) { | ||
/* brief description of how your implementation works */ | ||
int var1 = Expr1; | ||
... | ||
int varM = ExprM; | ||
varJ = ExprJ; | ||
... | ||
varN = ExprN; | ||
return ExprR; | ||
} | ||
Each "Expr" is an expression using ONLY the following: | ||
1. Integer constants 0 through 255 (0xFF), inclusive. You are | ||
程序设计实验一(位运算)
最新推荐文章于 2023-10-13 18:03:17 发布