thank you all for the help with the program check out this code
Code:
#include<iostream>
#include<cstring>
#include<cmath>
using namespace std;
template <class T , int r>
class myclass
{
private: T n[r];
public:
void read()
{
for(int i=0; i<r; ++i)
{
cout<<"Enter data: ";
cin>>n[i];
}
}
void show ()
{
for(int i=0; i<r; ++i)
{
cout<<"\t"<<n[i];
}
}
};
void main()
{
cout<<"Enter integer data\n";
myclass<int, 5> a;
a.read();
a.show();
cout<<"\nEnter character data\n";
myclass<char,5> b;
b.read();
b.show();
cout<<endl;
//myclass<string, 5>c;
//cout<<"Enter string data\n";
//c.read();
//c.show();
}
As all of you may have noticed I have commented out the last object "myclass<string, 5>c", and the reason behind that is because When I include it I get some wild error message. Does anyone know the remedy to this situation