1. Write a C++ code fragment that has a memory leak.
2. Write a C++ code fragment that accesses memory it should not.

#include <iostream>
using namespace std;
int main() {
int *num = new int;
*num = 5;
num = new int;
return 0;
}

#include <iostream>
using namespace std;
int main() {
int *num = new int;
delete num;
*num = 5;
return 0;
}
1. Write a C++ code fragment that has a memory leak. 2. Write a C++ code...