自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(8)
  • 收藏
  • 关注

原创 集装箱问题

问题描述: 一个工厂制造的产品都是长方体的,高为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 622

原创 c++中关于字符串常量的总结

1.c++ 中字符常量串实际上比表面多一位。eg:sizeof("CSDN")=5;类型是const char[5]2.允许用字符串常量给一个char *赋值,因为在原来的c/c++定义里,字符串常量就是char*  类型的。但如果想通过char *去改变字符串常里的值是不可以的。    eg: char * p="csdn" ; p[1]='w'; 这是错误的做法。3

2012-12-01 19:37:35 707

原创 字符串流的应用(stringstream\ istringstream ostringstream)

来看几个实例:1)用于输出不同格式的:  按行输入,然后按单词输出。    string word,line; while(getline(cin,line))       {           istringstream is(line);             while(is>>word)                  coutd;

2012-11-29 15:54:14 400

原创 鸡兔问题

# 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 348

原创 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 231

原创 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 293

原创 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 209

原创 How to construct a DiamondOfNumbers

Like this:We may  use the transform thought to solve this problem#include using namespace std; int main() { int Num; cout << "Enter any number in the range of 1 to 9 : ";

2012-10-06 16:31:30 212

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除