Problem with pointers and arrays

closed account (EwCjE3v7)
I get an error saying no match for operator<< in std::cout....

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
  #include <iostream>
#include <iterator>
#include <vector>
using std::cout; using std::endl; using std::cin;
using std::begin; using std::end;
using std::vector;

int main()
{
    int arr[10] = {1,2,3,4,5,6,7,8,9,0};

    for (int *pbeg = begin(arr); pbeg != end(arr); ++pbeg) {
        *pbeg = 0;
        cout << *pbeg << end; // <- this line
    }
    return 0;
}


If you would like me to get you a picture of the error, I can
cout << *pbeg << end; You want endl here
Last edited on
closed account (EwCjE3v7)
Oh stupid me, have school now but I'll compile it when I come back thanks
Topic archived. No new replies allowed.