A
asit
Please consider the following code
// dequeue.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <deque>
#include <algorithm>
using namespace std;
struct print
{
void operator() (int i)
{
cout<<" "<<i;
}
}myprint;
int _tmain(int argc, _TCHAR* argv[])
{
deque<int> first;
deque<int> second(4, 100);
deque<int> third(second.begin(), second.end());
deque<int> fourth = third;
int arr[] = {32, 5, 332, 78, 8};
deque<int> fifth(arr, arr+(sizeof(arr)/sizeof int)); //Line 28
cout<<"third : ";
for_each(third.begin(), third.end(), myprint);
cout<<endl;
cout<<"fourth : ";
for_each(fourth.begin(), fourth.end(), myprint);
cout<<endl;
cout<<"fifth : ";
for_each(fifth.begin(), fifth.end(), myprint);
cout<<endl;
return 0;
}
When I compile the above code it gives the following error.
Line 28 : type 'int' unexpected
Please tell me how to proceed ??
// dequeue.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <deque>
#include <algorithm>
using namespace std;
struct print
{
void operator() (int i)
{
cout<<" "<<i;
}
}myprint;
int _tmain(int argc, _TCHAR* argv[])
{
deque<int> first;
deque<int> second(4, 100);
deque<int> third(second.begin(), second.end());
deque<int> fourth = third;
int arr[] = {32, 5, 332, 78, 8};
deque<int> fifth(arr, arr+(sizeof(arr)/sizeof int)); //Line 28
cout<<"third : ";
for_each(third.begin(), third.end(), myprint);
cout<<endl;
cout<<"fourth : ";
for_each(fourth.begin(), fourth.end(), myprint);
cout<<endl;
cout<<"fifth : ";
for_each(fifth.begin(), fifth.end(), myprint);
cout<<endl;
return 0;
}
When I compile the above code it gives the following error.
Line 28 : type 'int' unexpected
Please tell me how to proceed ??