湛蓝之海 发表于 2021-12-31 14:21:07

C++ Primer(第五版)练习3.35

/*************************************************************************
    > File Name: 3_35.cpp
    > Author:
    > Mail:
    > Created Time: Wed 12 Apr 2017 09:05:41 PM CST
************************************************************************/

#include<iostream>
#include<random>
using namespace std;
int main()
{
    int arr;
    int *beg = begin(arr);
    int *last = end(arr);
    random_device rd;
    for(; beg != last; ++beg)
      *beg = rd() % 100;

    for(auto i : arr)
      cout<<i<<" ";
    cout<<endl;

    for(beg = begin(arr); beg != last; ++beg)
      *beg = 0;

    for(auto i : arr)
      cout<<i<<" ";
    cout<<endl;
    return 0;

}






https://blog.51cto.com/u_15268254/4867066
页: [1]
查看完整版本: C++ Primer(第五版)练习3.35