// C# 1.0 Style Threadusing System;using System.Threading; namespace ThreadSample{ class Program { static void Main(string[] args) { // C# 1.0 Style Thread uses ThreadStart ThreadStart ts = new ThreadStart(Work); Thread t1 = new Thread(ts); t1.Start(); for (int count = 0; count < Repetitions; count++) { Console.Write('@'); } } static void Work() { for (int count = 0; count < Repetitions; count++..
아래는 Composite Format String의 간단한 예제이다.string name = "John"; int age = 20; string gender = "male"; string phone = "012-3456-7890"; Console.WriteLine("First = {0}, Second = {1}, Third = {2}, Fourth = {3}", name, age, gender, phone);이 예제를 보면 {0} {1} {2} {3} 에 무엇이 대입될 것인지 하나씩 찾아보아야 Console.WriteLine 출력문이 이해가 된다. Console.WriteLine 출력문을 Interpolated String으로 바꾸면 아래와 같이 된다.Console.WriteLine($"First = {..
Logical Operator [C# C++ Java] 공통 Operator Logical Bitwise ! NOT YES - && AND YES - || OR YES - != XOR YES - Logical Operator [Python]OperatorLogicalBitwisenotNOTYES-andANDYES-orORYES-!=XORYES- Bitwise Operator [C# C++ Java Python] 공통 Operator Logical Bitwise ~ NOT - YES & AND can be used YES | OR can be used YES ^ XOR can be used YES 아래와 같이 Logical XOR Function(Method)을 정의해서 사용해도 된다. // [C#] Lo..
package coffee; public class Program { public static void main(String[] args) { String words = "Java"; char[] chars = words.toCharArray(); for (char t : chars) { // Java 10: for (var t : chars) System.out.println(t); } }} /* OutputJava*/ package coffee; public class Program { public static void main(String[] args) { String words = "Java"; for (int i = 0; i < words.length(); i++) { System.out.pri..
using System; namespace Console1{ class Program { static void Main(string[] args) { string words = "Hello"; foreach (var c in words) { Console.WriteLine(c); } } }} /* OutputHello*/ using System; namespace Console1{ class Program { static void Main(string[] args) { string words = "Hello"; for (int i = 0; i < words.Length; i++) { Console.WriteLine(words[i]); } } }} /* OutputHello*/
# Python 3 words = 'Python' for c in words: print(c) """ OutputPython""" # Python 3 words = 'Python' for i in range(len(words)): print(i, words[i]) """ Output0 P1 y2 t3 h4 o5 n""" # Python 3 words = 'Python' for i, c in enumerate(words): print(i, c) """ Output0 P1 y2 t3 h4 o5 n"""
// VC : suppress error messages about obsolete & deprecated functions#pragma warning(disable : 4996)#define _CRT_SECURE_NO_WARNINGS#define _CRT_SECURE_NO_WARNINGS_GLOBALS #include #define LENGTH 100 int main(){ int letter; char buffer[LENGTH]; char bumper[LENGTH]; letter = getchar(); // getchar is a wrapper function for fgetc putchar(letter); // putchar is a wrapper function for fputc letter = f..