티스토리 뷰


// [C++] String Concatenation

// VC : suppress error messages about obsolete & deprecated functions
#pragma warning(disable : 4996)
#define _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS_GLOBALS

#include <iostream>
#include <string>

using namespace std;

int main()
{
// string text0 = "Hello" + "World"; // error
string text1 = "Hello" "World";
cout << text1 << endl;

string word1 = "Hello";
string word2 = word1 + "World";
cout << word2 << endl;

char text2[11];
strcpy(text2, "Hello");
strcat(text2, "World");
printf(text2);
}




// [C#] String Concatenation

using System;

namespace Sharp1
{
class Program
{
static void Main(string[] args)
{
string text = "Hello" + "World";
Console.WriteLine(text);
}
}
}




# [Python] String Concatenation


def main():
text = "Hello" + "World"
print(text)


if __name__ == '__main__':
main()




// [Java] String Concatenation

package package1;

public class Program {
public static void main(String[] args) {
String text = "Hello" + "World";
System.out.println(text);
}
}


'Ongoing > String' 카테고리의 다른 글

[C# C++ Python] verbatim string, raw string literal  (0) 2019.04.19
[C#] Composite Format String & Interpolated String  (0) 2018.07.09
for [C/C++] char[] string  (0) 2018.06.21
for [Java] String  (0) 2018.06.20
for foreach [C#] string  (0) 2018.06.20
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
more
«   2025/02   »
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28
글 보관함