Wrox Programmer Forums
|
BOOK: Ivor Horton's Beginning Visual C++ 2013
This is the forum to discuss the Wrox book Ivor Horton's Beginning Visual C++ 2013 by Ivor Horton; ISBN: 978-1-118-84571-4
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Ivor Horton's Beginning Visual C++ 2013 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 31st, 2014, 12:59 PM
Authorized User
 
Join Date: Jan 2012
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default Compile Error at Ex10_14

The code:

Code:
// Ex10_14.cpp
// Using stream and inserter iterators
#include <iostream>
#include <numeric>
#include <vector>
#include <iterator>

int main()
{
  std::vector<int> numbers;
  std::cout << "Enter a series of integers separated by spaces"
    << " followed by Ctrl+Z or a letter:" << std::endl;

  std::istream_iterator<int> input{ std::cin }, input_end;
  std::ostream_iterator<int> out{ std::cout, " " };

  std::copy(input, input_end, std::back_inserter<std::vector<int>> {numbers});

  std::cout << "You entered the following values:" << std::endl;
  std::copy(std::cbegin(numbers), std::cend(numbers), out);

  std::cout << "\nThe sum of these values is "
    << std::accumulate(std::cbegin(numbers), std::cend(numbers), 0) << std::endl;
}
Errors List:

4 IntelliSense: expected a ')' c:\Users\Alexandros\Documents\Visual Studio 2013\Projects\Ex10_14\Ex10_14\Ex10_14.cpp 17 68 Ex10_14
Error 1 error C3321: initializer-list unexpected in this context c:\users\alexandros\documents\visual studio 2013\projects\ex10_14\ex10_14\ex10_14.cpp 17 1 Ex10_14
Error 2 error C2780: '_OutTy *std::copy(_InIt,_InIt,_OutTy (&)[_OutSize])' : expects 3 arguments - 2 provided c:\users\alexandros\documents\visual studio 2013\projects\ex10_14\ex10_14\ex10_14.cpp 17 1 Ex10_14
Error 3 error C2780: '_OutIt std::copy(_InIt,_InIt,_OutIt)' : expects 3 arguments - 2 provided c:\users\alexandros\documents\visual studio 2013\projects\ex10_14\ex10_14\ex10_14.cpp 17 1 Ex10_14

Error at Line 17 before
Code:
{numbers});

Last edited by BlueTower; October 31st, 2014 at 01:03 PM..





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Decipher Compile error: Syntax error Charlie07 BOOK: Excel VBA 24-Hour Trainer 1 August 23rd, 2013 10:07 AM
Compile error vbboyd BOOK: Beginning ASP.NET 4 : in C# and VB 3 May 19th, 2011 03:28 AM
Compile error: Syntax error: & Else without HELP Corey VB How-To 2 April 21st, 2006 03:25 PM
Compile error johnkruse Access VBA 3 June 16th, 2004 05:06 PM
compile error burdickdave C# 1 October 20th, 2003 01:46 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.