-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
29 lines (26 loc) · 720 Bytes
/
main.cpp
File metadata and controls
29 lines (26 loc) · 720 Bytes
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
29
//
// Created by zhangrongxiang on 2017/10/21 20:37
// File main
//
#include <iostream>
#include <cstring>
using namespace std;
int main() {
char ch[] = {'h', 'e', 'l', 'l', 'o', '\0'};
char ch2[15];
cout << ch << endl;
cout << sizeof(ch) << endl;
cout << "strlen(ch) : " << strlen(ch) << endl;
strcpy(ch2,ch);
cout << ch2 << endl;
strcat(ch2,ch);
cout << ch2 << endl;
cout << "------------------------------------------------" << endl;
string str = "hello world";
cout << str << endl;
cout << str.size() << endl;
cout << str.compare(str) << endl;
cout << str.compare("H") << endl;
cout << str + str << endl;
cout << str.append(" world ") << endl;
}