You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
489 B

#include "iostream"
#include "string"
template <typename T>
T f(T x) {
return x * x;
}
template <typename X>
void input(std::string message, X &target) {
std::cout << message;
std::cin >> target;
}
int main() {
std::string lang = "C";
std::string version = "++";
lang = lang + version;
std::cout << "Hello World, said by " << lang << "!" << std::endl;
int x = 0;
input("x = ", x);
std::cout << "f(x) = " << f<int>(x) << std::endl;
return 0;
}