im using the dev c++ compiler. the same one as at my high school. its a pretty basic program, it just wants me to read in 10 random numbers and show the average of the ten numbers and then list any of those numbers that is above the average. (using vectors) it ran perfectly at school. now it wont. maybe im making a simple error? its saying "apvector.h;no such file or directory. but this is the code my teacher gave me and it ran before. help please!

#include<iostream.h>
#include<iomanip.h>
#include"apvector.h"


int main()
{
    int num;
    int sum;
    int avg;

    apvector<int>num(10);

    for(int x=0;x<=9;x++)
    {
                     cout<<"Please enter a real number and press <enter> to continue"<<endl;
                     cin>>num[x];
    }

    system("cls");
    sum=num[0]+num[1]+num[2]+num[3]+num[4]+num[5]+num[6]+num[7]+num[8]+num[9];
    avg=sum/10;

    cout<<"The average of the ten numbers is: "<<avg<<endl;
    for(int x=0;x<=9;x++)
    {
           apvector<int>num(10);
           {
                   cout<<num[x]<<endl;
           }
    }

    system("pause");
    return 0;
}

Recommended Answers

All 4 Replies

so? make sure that header file is available to the compiler when you're compiling it.

The #include directive will, depending on wether it uses "" or <>, look in different places of your system to find the required files to compile.

<> looks in your compiler's include directory. With Visual Studio this could be by default:
C:\Program Files\Microsoft Visual Studio 9.0\VC\include

"" first looks in your project folder and, if it doesn't find it ther, it will look in the compiler's include directory.

Note that you can set up more inclusion directories with your compiler.

So, make sure you have the apvector.h file in the proper place.

Grab the .h and the associated .cpp file from here http://mathbits.com/mathbits/compsci/download.htm. Make the .cpp file a part of your project. Google is your friend...

Member Avatar for iamthwee

I honestly don't see the point to this assignment.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.