![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
c++
文章平均质量分 54
misserhardwork
这个作者很懒,什么都没留下…
展开
-
Exchange two numbers without another variable
Usually we exchange two numbers we need another temp variable ,it is possible to exchange without the temp.We can use bit compute. Two variables A =1,B=2; now do these: A=A^B;//A=0001^0010=0011;原创 2012-10-06 17:29:36 · 193 阅读 · 0 评论 -
Get some information of the file
//C++ Get the file state source //C++ Get the file's position //C++ Get the file's createing time //C++ Get the file's accessing time //C++ Get the file's last modifying time. The function we u原创 2012-10-07 11:35:56 · 288 阅读 · 0 评论 -
a += (a++)........which is right?
int a = 4; (A)a += (a++); (B) a += (++a) ; (C) (a++) += a; (D) (++a) +=(a++); a = ? (A) a=9; (B)=10; (C)=10 (D)=11原创 2012-10-10 16:53:37 · 222 阅读 · 0 评论 -
鸡兔问题
# include using namespace std; int main() { int nCase,i,nFeet; cin>>nCase; for( i=0;i<nCase;i++) { cin>>nFeet; if(nFeet%2!=0) cout<<0<<" "<<0<<endl; else if(nFeet%4!=0) cout<<nFeet原创 2012-11-27 21:18:24 · 339 阅读 · 0 评论 -
字符串流的应用(stringstream\ istringstream ostringstream)
来看几个实例: 1)用于输出不同格式的: 按行输入,然后按单词输出。 string word,line; while(getline(cin,line)) { istringstream is(line); while(is>>word) coutd;原创 2012-11-29 15:54:14 · 388 阅读 · 0 评论 -
集装箱问题
问题描述: 一个工厂制造的产品都是长方体的,高为h,长宽都相同,型号有1*1,2*2,3*3,4*4,5*5,6*6,集装箱都 为6*6*h,输入每个型号的产品的数量,计算用最少的集装箱的数量*/ 问题分析: 1.如果有一个6*6的产品就要开上个新箱子 2.如果有一个5*5的产品就要开一个新箱子,剩余空间只能放11个1*1的产品 3.如果有一个4*4的产品就要开一个新箱原创 2012-12-02 12:14:47 · 592 阅读 · 0 评论