Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- C++
- #include <iostream>
- void greet(std::string name) {
- std::cout << "Hello " << name << "!";
- }
- int main() {
- std::string name;
- std::cin >> name;
- greet(name);
- }
- java
- import java.util.Scanner;
- class Main {
- public static void main(String[] args) {
- Scanner s = new Scanner(System.in);
- greet((String)s.next());
- }
- public static void greet(String name) {
- System.out.println("Hello " + name + "!");
- }
- }
- python
- def greet(name):
- print("Hello " + name + "!")
- greet(input())
- C#
- using System;
- namespace Test {
- class Test {
- public static void greet(object name) {
- Console.WriteLine("Hello " + name + "!");
- }
- public static void Main(string[] args) {
- greet(Console.ReadLine());
- }
- }
- }
- JS (rhino)
- importPackage(java.io);
- importPackage(java.lang);
- var input = new BufferedReader( new InputStreamReader(System['in']) )
- print("Hello " + input.readLine() + "!");
- Swift
- func greet(person: String) {
- print("Hello " + person + "!")
- }
- if let str = readLine(){
- greet(person: str)
- }
- PHP
- <?php
- function greet($person) {
- echo "Hello $person!";
- }
- greet(readline());
- ?>
Add Comment
Please, Sign In to add comment