Compiler shows me this, but I can't seem to see what I'm missing.
main.cpp:45: error: expected `}' at end of input
There are two files this main.cpp and also a template at bottom:
#include<iostream> //C++ standard library header file I/O definitions
#include "file.h" //The template file file.h is included here
using namespace std; //Contains classes, objects and functions in the C++ library - no std :: scope
using namespace duram; //Resolves conflicting functions or variable names between the two libraries.
void instruct (void);
int main(int argc, char ** argv)
{
instruct();
int a[7] = { -4, -2, 0, 2, 4, 6, 7 };
double b[7] = { -7.5, -4.3, 0, 6, 4.4, 8.2, 9.6 };
int v;
cout << "The integers in array a are: ";
display<int>(a,7);
cout << "The real numbers in array b are: ";
display<double>(b,7);
cout << "The integers smaller than 4 in a are: ";
cout << count<int>(a,7,v);
cout << "The real numbers smaller than 4 in b are: ";
cout << count<double>(b,7,v);
return 0;
}
void instruct(void)
{
cout << endl << endl << "This program utilizes initialized arrays full of 7 digits" << endl; //instructions for user
cout << "and displays those array values using one template and" << endl; //instructions for user
cout << "finds and returns the quantity of values within less than 4." << endl << endl; //instructions for user
}
TEMPLATE file.h
#include<iostream>
using namespace std;
namespace duram
{
template<typename T>
void display(T*a, int N){
for (int i=0; i<N; i++)
cout << a << " ";
}
template<typename T>
T count(T*a, int N, T v) {
int counter = 0;
for(int i=0; i<N; i++)
{ if (a<v)
counter++;
}
return counter;
}