UNI_Python/_pruefung/codings.cpp

24 lines
489 B
C++
Raw Normal View History

2024-02-29 22:31:32 +01:00
#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;
}