-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmemorymanagement.cpp
More file actions
83 lines (69 loc) · 1.48 KB
/
memorymanagement.cpp
File metadata and controls
83 lines (69 loc) · 1.48 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <ios>
#include <stdexcept>
//#include "grade.h"
#include <iomanip>
#include <map>
#include <sstream>
//#include <boost/filesystem.hpp>
#include <conio.h>
#include <fstream>
#include <cstring>
#include <memory>
using namespace std;
template<class T> class allocator {
public:
T* allocate(size_t);
void deallocate(T*, size_t);
void construct(T*, const T&) ;
void destroy(T*);
};
template<class Out, class T> void uninitialized_fill(Out, Out, const T&);
template<class In, class Out> Out uninitialized_copy(In, In, Out);
int* invalid_pointer(){
int x;
return &x;
}
int* pointer_to_static(){
static int x;
return &x;
}
int* pointer_to_dynamic(){
return new int(0);
}
char* duplicate_chars(const char* p){
size_t lenght=strlen(p)+1;
char* result=new char[lenght];
copy(p,p+lenght,result);
return result;
}
int main(int argc, char** argv){
//dosya oluþturma
/*ifstream infile("in");
ofstream outfile("out");
string s;
while (getline(infile, s))
outfile << s << endl;*/
//yazý yazma - guzel bilgi
int fail_count=0;
for(int i=0; i<argc;++i){
ifstream in(argv[i]);
if(in){
string s;
while(getline(in,s))
cout<<s<<endl;
}
else{
cerr<<"cannot open file "<<argv[i]<<endl;
++fail_count;
}
}
invalid_pointer();
pointer_to_static();
pointer_to_dynamic();
duplicate_chars("");
return fail_count;
}