Category : C++ Source Code
Archive   : CPPTUT.ZIP
Filename : NEWDEL.CPP

 
Output of file : NEWDEL.CPP contained in archive : CPPTUT.ZIP
// Chapter 3 - Program 2
#include

struct date {
int month;
int day;
int year;
};

main()
{
int index, *point1, *point2;

point1 = &index;
*point1 = 77;
point2 = new int;
*point2 = 173;
cout << "The values are " << index << " " <<
*point1 << " " << *point2 << "\n";
point1 = new int;
point2 = point1;
*point1 = 999;
cout << "The values are " << index << " " <<
*point1 << " " << *point2 << "\n";
delete point1;

float *float_point1, *float_point2 = new float;

float_point1 = new float;
*float_point2 = 3.14159;
*float_point1 = 2.4 * (*float_point2);
delete float_point2;
delete float_point1;

date *date_point;

date_point = new date;
date_point->month = 10;
date_point->day = 18;
date_point->year = 1938;
cout << date_point->month << "/" << date_point->day << "/" <<
date_point->year << "\n";
delete date_point;

char *c_point;

c_point = new char[37];
delete c_point;
c_point = new char[sizeof(date) + 133];
delete c_point;
}




// Result of execution
//
// The values are 77 77 173
// The values are 77 999 999
// 10/18/1938


  3 Responses to “Category : C++ Source Code
Archive   : CPPTUT.ZIP
Filename : NEWDEL.CPP

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/