Template class

Initially, the task was to implement a class that would define the type of the input string variable (int or char), I did it. Now,  need to convert this class into a template class ..and class template parameter - type of position.Help me please.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <iostream>
#include <ctype.h>
#include <string>
using namespace std;
class Checker 
{
	string s; 
	char ch;  
	int pos;  
public:
	Checker() {}
	void enterString()
	{
		cout << "Enter string: ";
		getline(cin, s);
	}
	void enterPosition() 
	{
		cout << "Enter position: ";
		cin >> pos;
	}
	void check() 
	{
		ch = s.at(pos); 
		bool check = isdigit(ch);

		if (check == 0)
			cout << ch << "  type char" << endl;
		else
			cout << ch << "  type int " << endl;
	}
};
int main()
{
	Checker ch;
	ch.enterString();
	ch.enterPosition();
	ch.check();
	system("pause");
	return 0;
}
Topic archived. No new replies allowed.