自增運算符(待解)

        代碼段一:ios

#include<iostream>
#include<iomanip>
using namespace std;
 
//void main( void )
int main()
{
    int k=8;
         cout<<k<<'\t'<<k++<<endl;
         cout<<k<<setw(8)<<k++<<endl<<endl;
         cout<<k<<'\t'<<++k<<endl;
         cout<<k<<setw(8)<<++k<<endl<<endl;
         cout<<k<<setw(8);
         k++;
         cout<<k<<endl;
         return 0;
}


        代碼段二:spa

#include<iostream>
#include <string>
#include<iomanip>
using namespace std;
void main( void )
{
         int i=3,j=3;
         int k=(++i)+(++i)+(++i);  //編譯器採用貪心法閱讀字符方式
         int m=(j++)+(j++)+(j++);
         cout<<k<<'\t'<<i<<endl;
         cout<<m<<'\t'<<j<<endl;
}
相關文章
相關標籤/搜索