CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8

Threaded View

  1. #1
    Join Date
    Oct 2007
    Posts
    18

    C++ Vector question??

    I am getting these errors but I can't figure out why. I know it has something to do with the .h file but I am stumped, thanks in advance. My error messages are attached.

    //.h file

    #include <iostream>
    #include <tchar.h>
    #include <vector>

    void printarray (vector<int> *invector);



    //.cpp file

    #include "stdafx.h"
    #include <iostream>
    #include <conio.h>
    #using <mscorlib.dll>
    #include <vector>
    using namespace std;

    void printarray (vector<int> *invector)
    {
    for (int n=0; n < invector->size(); n++)
    cout << invector->at(n) << " ";
    cout << "\n";
    }

    int main ()
    {
    vector<int> FA;
    FA.push_back(5);
    FA.push_back(10);
    FA.push_back(15);

    vector<int> SA;
    SA.push_back(2);
    SA.push_back(4);
    SA.push_back(6);
    SA.push_back(8);
    SA.push_back(10);

    printarray (&FA);
    printarray (&SA);
    getch();
    return 0;
    }
    Attached Images Attached Images

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured