Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Simple use of function templete and namespace
// Simple use of function templete and namespace #include<iostream> using namespace std; namespace first { int i,j,k; } namespace second{ double i,j,k; } template<typename T> T sum(T a, T b) { T result; result= a+b; return result; } int main() { using namespace second; first::i=4,first::j=6; first::k=sum<int>(first::i,first::j); cout<<endl<<"K= "<<first::k<<endl; i=8.345,j=879.45; k=sum<double>(i,j); cout<<endl<<"k= "<<k<<endl; return 0; }
run
|
edit
|
history
|
help
0
Pairs having sum equal to target
Decimal to Binary
Test 12(2021)
MyStringv2
cpp ex 3 - solution
Test 1(2018)
Age
string_match
不带头结点的单链表
replace_copy_if-30-Seconds-of-C++