-
Notifications
You must be signed in to change notification settings - Fork 1
/
44.cpp
47 lines (42 loc) · 773 Bytes
/
44.cpp
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <iostream>
#include "E44.h"
#include <vector>
using std::vector;
using std::cin;
using std::cout;
using std::endl;
void test(){
const char* s = "wang";
int count = 0;
while(*s != '\0'){
cout << *s << "---";
++s;
++count;
}
cout << endl;
cout << count << endl;
}
void print(const String& s){
for(auto i : s){
cout << i << "";
}
}
int main(){
const char* s = "hello, world";
const String st(s);
print(st);
cout << endl << "---";
cout << st.size() << endl;
// st.push_back('x');
// st.push_back('x');
print(st);
cout << endl;
// String stt = st; // What is the problem when I have an assignment operator.
// print(stt);
cout << "<<" << endl;
std::vector<int> v{1,2,3};
vector<int> m = v;
for(auto i : m){
cout << i << endl;
}
}