int main()
{
int a, b;
cout<<"a="<<hello1()<<" b="<<hello2()<<endl;
return 0;}
int hello1()
{
cout<<"hello1"<<endl;
return 1;
}
int hello2()
{
cout<<"hello2"<<endl;
return 2;
}
一時讓人有點難以琢磨,網上給出了其靠譜的解釋:cout流的操作順序是:先從右往左讀入緩沖區,然后再從左往右輸出。所以它從右邊往左讀的時候,碰到了函數當然去執行函數先了,然后把函數返回值讀入緩沖區再然后。。。就是從左輸出了。
根據這個解釋,有實驗的幾個程序,能加深點理解
程序1:
程序2:
新聞熱點
疑難解答
圖片精選