p108 3.35 3.36

来源:互联网 发布:下拉框刷词软件 编辑:程序博客网 时间:2024/06/05 07:15

3.35

// 108_335_336.cpp : 定义控制台应用程序的入口点。
//


#include "stdafx.h"
#include<iostream>
#include<iterator>
using namespace std;


int main()
{
int arr[3] = { 1,1,1 };
int *p = arr;
int *beg = begin(arr);
int *last = end(arr);
while(p<last)//不能叫end????
{
cout << *p << " ";//要先输出,不然++p后再输出就不是那个数了
p++;
}
cout << endl;
p = arr;//不回去就输不出
while (p<last)//不能叫end????
{
*p = 0;
cout << *p << " ";//要先输出,不然++p后再输出就不是那个数了
p++;
}
cout << endl;
system("pause");
return 0;
}

3.36