#include <iostream>
usingnamespace std;
template <class T>
class maximum
{
public:
maximum(T num1,T num2)
{
Num1 = num1;
Num2 = num2;
}
T getMax();
private:
T Num1;
T Num2;
};
template<class T>
T maximum<T>::getMax()
{
return (Num1 > Num2 ? Num1: Num2);
}
void getnum(int*,int*);
int main()
{
int num1, num2;
cout<<"Enter two integars, seperated by a comma: ";
getnum(&num1,&num2);
maximum<int> m(num1,num2);
cout<<m.getMax();
system("pause");
return 0;
}
void getnum(int* num1,int* num2)
{
char c;
cin.getline(c,",");//invalid conversion from 'const char*' to 'int'
(*num1) = c - '0'; //invalid conversion from 'char*' to 'int'
cin.getline(c,"\n");//invalid conversion from 'const char*' to 'int'
(*num2) = c- '0';//invalid conversion from 'char*' to 'int'
}
First of all, cin.getline() takes a char * for its first argument; the second argument is a streamsize (the size of your first argument; and finally a char for the delimiter, not a character strings as you have it.