HR30 Day 0: Hello, World.

Jmnote (토론 | 기여)님의 2018년 7월 28일 (토) 17:41 판 (→‎C++)

1 개요

Day 0: Hello, World.

2 C

#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
int main() {
    char input_string[105]; 
    scanf("%[^\n]", input_string); 
    printf("Hello, World.\n");
    printf("%s\n", input_string);
    return 0;
}

3 C++

#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
    string input_string; 
    getline(cin, input_string); 
    cout << "Hello, World." << endl;
    cout << input_string << endl;
    return 0;
}

4 Java

public class Solution {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in); 
		String inputString = scan.nextLine(); 
		scan.close(); 
        System.out.println("Hello, World.");
        System.out.println( inputString );
	}
}

5 PHP

<?php
$_fp = fopen("php://stdin", "r");
$inputString = fgets($_fp);
print("Hello, World.\n");
echo $inputString;
fclose($_fp);

6 Python

input_string = input()
print('Hello, World.')
print(input_string)

7 같이 보기

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}