restructured
This commit is contained in:
parent
c495b7c47f
commit
66cefdfd63
204 changed files with 538 additions and 13662 deletions
34
seminar03_initialization/06_new/main.cpp
Normal file
34
seminar03_initialization/06_new/main.cpp
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
#include <iostream>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
int *x = new int{123};
|
||||
cout << *x << endl;
|
||||
|
||||
string *str = new string{"Cats and Dogs"};
|
||||
cout << *str << endl;
|
||||
|
||||
int *xs = new int[]{10, 20, 30, 40, 50};
|
||||
for (int i = 0; i < 5; ++i)
|
||||
cout << xs[i] << " ";
|
||||
cout << endl;
|
||||
|
||||
string *strs = new string[]{"Cat", "Dog", "Mouse"};
|
||||
for (int i = 0; i < 3; ++i)
|
||||
cout << strs[i] << " ";
|
||||
cout << endl;
|
||||
|
||||
string_view *str_views = new string_view[]{strs[0], strs[1], strs[2]};
|
||||
for (int i = 0; i < 3; ++i)
|
||||
cout << str_views[i] << " ";
|
||||
cout << endl;
|
||||
|
||||
delete x;
|
||||
delete str;
|
||||
delete[] xs;
|
||||
delete[] strs;
|
||||
delete[] str_views;
|
||||
}
|
||||
Reference in a new issue