Board logo

標題: 指標 (七) - 陣列 3 [打印本頁]

作者: tonyh    時間: 2014-9-20 16:22     標題: 指標 (七) - 陣列 3

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.      int n[]={1,3,5,7,9};
  7.      int *nPtr=n;
  8.      cout<<*nPtr<<endl;
  9.      cout<<*(nPtr+=1)<<endl;
  10.      cout<<*(nPtr+=3)<<endl;
  11.      cout<<*(nPtr-=2)<<endl;
  12.      cout<<*(++nPtr)<<endl;
  13.      cout<<*(--nPtr)<<endl;
  14.      cout<<*nPtr<<endl;
  15.      system("pause");
  16.      return 0;
  17. }
複製代碼

作者: 張峻瑋    時間: 2014-9-20 16:24

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.      int n[]={1,3,5,7,9};
  7.      int *nPtr=n;   
  8.      cout<<*nPtr<<endl;
  9.      cout<<*(nPtr+=1)<<endl;
  10.      cout<<*(nPtr+=3)<<endl;
  11.      cout<<*(nPtr-=2)<<endl;
  12.      cout<<*(++nPtr)<<endl;
  13.      cout<<*(--nPtr)<<endl;
  14.      cout<<*nPtr<<endl;
  15.      system("pause");
  16.      return 0;
  17. }
複製代碼

作者: 劉得恩    時間: 2014-9-20 16:24

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.      int n[]={1,3,5,7,9};
  7.      int *nPtr=n;
  8.      cout<<*nPtr<<endl;
  9.      cout<<*(nPtr+=1)<<endl;
  10.      cout<<*(nPtr+=3)<<endl;
  11.      cout<<*(nPtr-=2)<<endl;
  12.      cout<<*(++nPtr)<<endl;
  13.      cout<<*(--nPtr)<<endl;
  14.      cout<<*nPtr<<endl;
  15.      system("pause");
  16.      return 0;
  17. }
複製代碼

作者: 劉得旗    時間: 2014-9-20 16:25

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.      int n[]={1,3,5,7,9};
  7.      int *nPtr=n;
  8.      cout<<*nPtr<<endl;
  9.      cout<<*(nPtr+=1)<<endl;
  10.      cout<<*(nPtr+=3)<<endl;
  11.      cout<<*(nptr-=2)<<endl;
  12.      cout<<*(++nPtr)<<endl;
  13.      cout<<*(--nPtr)<<endl;
  14.      cout<<*nPtr<<endl;
  15.      system("pause");
  16.      return 0;
  17. }
複製代碼

作者: 李允軒    時間: 2014-9-20 16:25

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.      int n[]={1,3,5,7,9};
  7.      int *nPtr=n;
  8.      cout<<*nPtr<<endl;
  9.      cout<<*(nPtr+=1)<<endl;
  10.      cout<<*(nPtr+=3)<<endl;
  11.      cout<<*(nPtr-=2)<<endl;
  12.      cout<<*(++nPtr)<<endl;
  13.      cout<<*(--nPtr)<<endl;
  14.      cout<<*nPtr<<endl;
  15.      system("pause");
  16.      return 0;
  17. }
複製代碼

作者: 周雍程    時間: 2014-9-20 16:25

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.      int n[]={1,3,5,7,9};
  7.      int *nPtr=n;   
  8.      cout<<*nPtr<<endl;
  9.      cout<<*(nPtr+=1)<<endl;
  10.      cout<<*(nPtr+=3)<<endl;
  11.      cout<<*(nPtr-=2)<<endl;
  12.      cout<<*(++nPtr)<<endl;
  13.      cout<<*(--nPtr)<<endl;
  14.      cout<<*nPtr<<endl;
  15.      system("pause");
  16.      return 0;
  17. }
複製代碼

作者: 張郁庭    時間: 2014-9-20 16:26

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.      int n[]={1,3,5,7,9};
  7.      int *nPtr=n;
  8.      cout<<*nPtr<<endl;
  9.      cout<<*(nPtr+=1)<<endl;
  10.      cout<<*(nPtr+=3)<<endl;
  11.      cout<<*(nPtr-=2)<<endl;
  12.      cout<<*(++nPtr)<<endl;
  13.      cout<<*(--nPtr)<<endl;
  14.      cout<<*nPtr<<endl;
  15.      system("pause");
  16.      return 0;
  17. }
複製代碼

作者: 林宇翔    時間: 2014-9-20 16:30

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.      int n[]={1,3,5,7,9};
  7.      int *nPtr=n;
  8.      cout<<*nPtr<<endl;
  9.      cout<<*(nPtr+=1)<<endl;
  10.      cout<<*(nPtr+=3)<<endl;
  11.      cout<<*(nPtr-=2)<<endl;
  12.      cout<<*(++nPtr)<<endl;
  13.      cout<<*(--nPtr)<<endl;
  14.      cout<<*nPtr<<endl;
  15.      system("pause");
  16.      return 0;
  17. }
複製代碼

作者: 張彥承    時間: 2014-9-20 16:39

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.      int n[]={1,3,5,7,9};
  7.      int *nPtr=n;
  8.      cout<<*nPtr<<endl;
  9.      cout<<*(nPtr+=1)<<endl;
  10.      cout<<*(nPtr+=3)<<endl;
  11.      cout<<*(nPtr-=2)<<endl;
  12.      cout<<*(++nPtr)<<endl;
  13.      cout<<*(--nPtr)<<endl;
  14.      cout<<*nPtr<<endl;
  15.      system("pause");
  16.      return 0;
  17. }
複製代碼





歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://istak.org.tw/seed/) Powered by Discuz! 7.2