/
main.cpp
68 lines (55 loc) · 1.66 KB
/
main.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include "String.h"
#include <stdio.h>
int main(){
String str;
String str2("Salut");
String str4("Beaucoup");
String str3(str2);
printf("Length : %zu \n",str2.length());
printf("Max_Size : %zu \n",str2.max_size());
str2.resize((size_t)7);
printf("Size: %zu \n",str2.size());
str2.clear();
printf("Size: %zu \n",str2.size());
const char* essai=str3.c_str();
printf(essai);
String str6=str4 +" trop" ;
str2='c';
str2.resize((size_t)3,'c');
//~ String str6(str);
str2.resize((size_t)102,'c');
str2='c';
String operatoregal;
operatoregal=str4;
printf("Size: %zu \n",operatoregal.size());
printf("%zu \n",str2.capacity()) ;
printf("%d \n",str2.empty()) ;
printf("%d \n",str.empty()) ;
String str5("Hello !") ;
printf("Size : %zu\n",str5.length()) ;
printf("Capacity : %zu\n",str5.capacity()) ;
str5.reserve((size_t)10) ;
printf("Size : %zu\n",str5.length()) ;
printf("Capacity : %zu\n",str5.capacity()) ;
str5.reserve((size_t)9) ;
printf("Size : %zu\n",str5.length()) ;
printf("Capacity : %zu\n",str5.capacity()) ;
str5.reserve((size_t)5) ;
printf("Size : %zu\n",str5.length()) ;
printf("Capacity : %zu\n",str5.capacity()) ;
//~ str5.reserve((size_t)200) ;
//~ printf("Size : %zu\n",str5.length()) ;
//~ printf("Capacity : %zu\n",str5.capacity()) ;
//~
String str360;
str360=str2+'d';
printf("Size : %zu\n",str360.length()) ;
String elea1("Bla");
printf("Size : %zu\n",elea1.length()) ;
printf("Capacity : %zu\n",elea1.capacity()) ;
String elea2(" bla");
String elea3 = elea1 + elea2 ;
printf("Size : %zu\n",elea3.length()) ;
printf("Capacity : %zu\n",elea3.capacity()) ;
return 0 ;
}