/* Function template demo to check max number in c++ */ #include "iostream" using namespace std; template <typename T> T getMax(T x, T y){ return (x>y?x:y); } int main(){ cout<<"Max No: "<< getMax <int> (4,5)<<endl; return 0; } /* OUTPUT [pavan@localhost Template]$ g++ FunctionTemplate.cpp [pavan@localhost Template]$ ./a.out Max No: 5 [pavan@localhost Template]$ */
The Tech Zone is built to promote open source technologies. Hadoop, Linux Administration, Cloud, Java Technologies, Operating Systems, Advanced Computer Programming, etc are the key areas of focus. Computer and IT engineering students can find important study material on this portal.
Thursday, 21 September 2017
Function template to check max numebr in C++
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment