锘??xml version="1.0" encoding="utf-8" standalone="yes"?>
]]>
1銆佸叧浜庡垵濮嬪寲:
deque<string> Deque;// 涓涓猟eque瀹瑰櫒
deque<string> Deque2(Deque.begin(),Deque.end()); // 涓縐嶅垵濮嬪寲
copy(Deque.begin(),Deque.end(),back_inserter(Deque2) ); // 涓縐嶅垵濮嬪寲
deque<string> Deque3(istream_iterator<string>(cin),istream_iterator<string>()); // 涓縐嶅垵濮嬪寲
typedef istream_iteraor<string> (Func)();
deque<string> Deque3(istream_iteraotr<string> cin, Func);
鐪嬩笂鍘誨儚涓涓嚱鏁板0鏄庯紝
typedef istream_iteraor<string> (Func)();
deque<string> f(stream_iteraor<string> ,Func);
鐜板湪姣旇緝娓呮櫚浜嗗惂錛屽緢鍍忎竴涓嚱鏁板0鏄庝簡錛?br>
鎵浠ョ涓夌鍒濆鍖栨柟寮忔牴鏈氨涓嶈兘鍋氫換浣曚簨鎯?
//濡傛灉鐪熺殑瑕佽揪鍒板垵濮嬪寲鐨勭洰鏍囷紝鍙互閫氳繃鎷彿鏉ユ秷闄や簩涔夋?/span>
deque<string> Deque3( (istream_iterator<string> (cin)) , istream_iterator<string>() );
int main()

{
double x = 1e8;
while(x >0)
x--;

return 0;
}
#include <iostream>
#include <iomanip>
using namespace std;
int main()

{
int x = 1;
for (int i =0 ; i < 100; i++)
{
;
}
// 涓嬮潰榪欒浠g爜浼?xì)骞蹭簺浠涔堬紵閫掑???????/
++x;
std::cout << x << std::endl;
return 0;
}
struct X 

{
static bool f(int *p)
{
return p &&0[p] and not p[1:>>p[2];
}
};鍏堜竴姝ヤ竴姝ョ殑鍒嗘瀽
1:0[p] 鍏跺疄鍜宲[0]涓鏍?br>2: and not閮芥槸鏈夋晥鍏抽敭瀛?錛屼粬浠垎鍒槸&& 鍜?
3::>绔熺劧涔熸槸鍚堟硶鐨勶紝浠栨槸]鐨勫弻瀛楃鍐欐硶銆?/p>
鎵浠ヨ繖涓鍙ヤ細(xì)琚В鏋愪負(fù) return p && p[0] && !p[1]>p[2] 錛屾病鏈夎娉曢敊璇?br>寰堣寮傘?/p>
# include <iostream>
using namespace std;
#define Q(x) x*x
int main()

{
int a =10;
int b = 2;
int c = 1;
a /=Q(b+c)/Q(b+c);
cout << a <<endl;
return 0;
}
鍥犱負(fù) 瀹廞(x) 涓嶈鑼冿紝
鎵浠ョ粨鏋?寰堣糠鎯戜漢
a /=Q(b+c)/Q(b+c);鐨勬墽琛岄『搴忔槸浠庡彸鍒板乏
tmp = Q(b+c)/Q(b+c) = 2+1*2+1 / 2+1*2+1 =2+2+0+2+1=7 娌℃湁瀵瑰畯鍔犳嫭鍙鋒槸緇忓父瀹規(guī)槗鐘敊錛?br>
a = a/tmp = 10/7 = 1
鎵浠?nbsp; a = 1;
-----------------------------------------
棰樼洰2
鍙嶈漿涓涓瓧絎︿覆錛堣タ灞卞眳絎旇瘯棰橈級錛?br>棰樼洰錛氬啓涓涓嚱鏁幫紝鎶婁竴涓互0瀛楃緇撳熬鐨勫瓧絎︿覆str涓殑'A'瀛楃縐誨埌str鐨勬湯灝撅紒
鍒嗘瀽錛?br>1錛氫互鏃墮棿鎹㈢┖闂?nbsp; 浠庡悗鍚戝墠寰幆鏌ユ壘瀛楃A
2錛氫互絀洪棿鎹㈡椂闂?nbsp; 涓嬈″驚鐜?
綆楁硶1浠g爜錛?br>
void Deal(char *str )

{
int len = strlen(str);
int a= len-1,b=0;
if (str[a] != '0')
{
return; //濡傛灉鏈鍚庝竴涓瓧絎︿笉涓?0'
}
while (a>=0)
{
if (str[a] == 'A')
{
int n = a;
while (n < len-b-1)
{
str[n] = str[n+1]; //
n++;
}
str[n] ='A';
b++; //b绱姞錛岃〃紺烘湁b涓瓧絎
}
a--;
}
}
void Deal(char *str )

{
int len = strlen(str);
int a= len-1,b=0,i=0,j=0;
if (str[a] != '0')
{
return; //濡傛灉鏈鍚庝竴涓瓧絎︿笉涓?0'
}
char * tmp = new char[len+1];
while(i<len)
{
if(str[i] !='A')
tmp[j++] = str[i];
else
b++; //澶氬皯涓瓧絎
i++;
}
while (j<len)
{
tmp[j++] = 'A';
}
tmp[len] = '\0';
strcpy(str,tmp);
delete tmp; //閲婃斁絀洪棿
tmp = NULL;
}
# include <iostream>
using namespace std;
class base

{
public:
base():m_val2(0)
{
}

int &get1()
{return m_val1;}
int &get2()
{return m_val2;}


static int getr1(int &a)
{return a++;}
static int getr2(int &a)
{return a++;}
private:
static int m_val1;
int m_val2;
};
int base::m_val1 = 0;
void print(int val)

{
static int count = 1;
cout << count++ <<",val = "<<val<<endl;
}
int main()

{
base o1;
base o2;
print(o1.getr1(o1.get1()));
print(o1.get1());
print(o2.get1());
print(o1.getr1(o1.get1()));
print(o1.get1());
print(o2.get1());
print(o1.getr1(o1.get1()));
print(o1.get1());
print(o2.get1());
print(o1.getr2(o1.get2()));
print(o1.get2());
print(o2.get2());
return 0;
}
//宸茬煡緇撴瀯浣?/span>
struct node

{
node * link;
node * next;
};
struct test

{
int a1;
int a2;
//
node *no;
int aj;
//
..
};
鐜板湪鏈変竴鍑芥暟
# include <iostream>
# include <stdio.h>
struct node

{
node * link;
node * next;
};
struct test

{
int a1;
int a2;
//
node *no;
int aj;
//
..
};
int main()

{
test *t = new test; //
node **a = &(t->no);
printf("t = %p\na = %p\n",t,a);//杈撳嚭t錛宎鐨勫湴鍧錛?/span>
printf("t = %p\n",a-2);//杈撳叆鎴戜滑璁$畻鐨勫湴鍧
return 0;
}

# include <iostream>
using namespace std;
class base

{
public:
base()
{
cout <<" base::val "<<endl;
val = 12345;
print();
}
base(int x)
{
val = x;
cout << " "<<endl;
}
virtual void print()
{
cout << " base:print(), val = "<<val<<endl;
}
base & operator = (int x)
{
val = x;
cout <<" base::operator, val = "<<x<<endl;
return *this;
}
void relase()
{
cout << " base::relase" <<endl;
}
~base()
{
cout << " ~base::val = "<< val <<endl;
}
protected:
int val;
};
class deiver:public base

{
public:
deiver()
{
cout << " deiver::val "<<endl;
}
deiver(int x)
{
val = x;
print();
}
void print()
{
cout << " deiver::print(), val = "<< val <<endl;
}
void relase()
{
cout << " deiver::relase, val = "<<val<<endl;
}
deiver & operator = (int x)
{
val = x;
cout <<" deiver::operator, val = "<<x<<endl;
return *this;
}
~deiver()
{
cout << " deiver::~deiver "<<endl;
}
};
void des(base * b)

{
b->print();
b->relase();
}
deiver de = 98765;
int main()

{
deiver * dee = new deiver;
*(base *)dee = 100;
des(dee);
return 0;
}