




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
概述
C++是一门混合型面向对象程序设计语言,它兼容了C语言并弥补了其缺陷,增加了面身对象的能力。其中,改造后的C语言是面向对象部分的基础。一般语法的改进指针和引用函数的改进类和对象构造函数和析构函数C++程序的开发过程
C++语言是一种高级程序设计语言,它的开发过程与其他高级语言程序开发过程类似,一般要经过四个步骤:
执行编辑编译链接编辑 是指把按照C++语法规则编写的程序代码通过编辑器(BorlandC++,VisualC++,TurboC++等)输入计算机,并存盘。在存盘时,C++源文件的扩展名为.CPP。编译 将编辑好的C++源程序通过编译器转换为目标文件(OBJ文件)。即生成该源文件的目标代码。C++程序的开发过程链接 将用户程序生成的多个目标代码文件(.obj)和系统提供的库文件(.lib)中的某些代码连接在一起,生成一个可执行文件(.exe)。执行 把生成的可执行文件运行,在屏幕上显示运行结果。用户可以根据运行结果来判断程序是否出错。C++程序的开发过程C++程序的开发过程书写格式
C++语言程序的书写格式自由度高,灵活性强,随意性大,如一行内可写一条语句,也可写几条语句;一个语句也可分写在多行内。不过应采用适当的格式书写,便于人们阅读和理解。 为了增加程序的可读性和利于理解,编写程序时按如下要点书写:
(1)一般情况下每个语句占用一行。 (2)不同结构层次的语句,从不同的起始位置开始,即在同一结构层次中的语句,缩进同样的字数。 (3)表示结构层次的大括弧,写在该结构化语句第一个字母的下方,与结构化语句对齐,并占用一行。 (4)适当加些空格和空行。C++程序的开发过程C++语言程序由以下基本部分组成。1.函数一个C++程序是由若干个函数构成的。函数分为库函数(标准函数)和自定义函数。库函数一般是由系统提供的。一个完整的C++语言程序只有一个主函数。2.预处理命令预处理命令以位于行首的符号“#”开始,C++提供的预处理有宏定义命令、文件包含命令和条件编译命令三种。2.1C++程序的开发过程3.程序语句一条完整的语句必须以分号“;”结束。程序语句有如下几类:(1)说明语句
用来说明变量的类型和初值。 如下面语句是把变量说明为浮点数。
floata,b,c;
又如下面语句是把变量sum说明为整型变量,并赋初值为零。
intsum=0;
C++程序的开发过程(2)表达式语句
由一个表达式构成一个语句,用以描述算术运算、逻辑运算、或产生某种特定动作,在任何表达式最后加一个分号就构成了一个语句。如下例由赋值表达式加“;”就构成一个赋值表达式语句。(3)程序控制语句
用来描述语句的执行条件与执行顺序的语句,C++语言的控制语句有9种,如下页所示。其语句中的括号()表示其中是条件,~表示内嵌的语句。C++程序的开发过程if
()~else
条件语句for
()~ 循环语句while
()~ 循环语句do~while
() 循环语句continue
结束本次循环语句break
中止循环式(switch语句)switch
多分支选择语句goto
转移语句return
从函数返回语句C++程序的开发过程(4)复合语句
复合语句是一种十分重要的语句,由大括号{和}把一些说明和语句组合在一起,使它们在语法上等价于一个简单语句;可由若干简单语句或复合语句组成。
例如:if(a>b) {c=a-b; d=c*a; }
else {c=a+b; d=c*b; }2.1C++程序的开发过程2.1C++语言的特点
C++是Bjarne
Stroustrup
在贝尔实验室开发的一种语言,是C语言的超集和扩展。C++保留了C语言的有效性、灵活性、便于移植等特点,又添加了对面向对象的支持。由C语言扩展而来,全面兼容C语言2.2C++语言文件扩展名C语言源文件扩展名.cC++语言源文件扩展名.cpp相关头文件扩展名.h2.3注释符号2.4名字空间
C++里引入namespace的目的就是为了避免污染全局名字空间,简单地说,就是为了避免和减少命名冲突。一旦一个程序写大了,就很难避免重名,特别是多人合作的情况下。解决相同的函数名,或变量名,或者两个不同的库里面有相同的函数名,相当于一个文件域.2.4名字空间定义namespacens1{floata,b,c;fun1(){….}}使用域内成员,需要使用域操作符号“::”
ns1::a;ns1::fun1();2.4名字空间分层嵌套定义namespacens1{namespacens2{classmatrix{…}}}
访问matrix,可写成n1::n2::matrix。全局名字空间2.4名字空间使用使用关键字using
usingns1::ns2::martix
以后在再次使用martix,可以直接使用使用usingnamespace名字空间名空间所有成员都可以被直接使用usingnamespacestdc++所有组件都在std中,通过该语句则可以使用标准C++库所有成员,注意此时若使用include包含头文件,要去掉头文件扩展名2.5c++语言的输入输出CC++见:p18例2.12.6变量的定义变量初始化
C++支持两种形式的初始化第一种形式是使用赋值操作符的显式语法形式
int
ival=1024;stringproject="Fantasia2000";在隐式形式中初始值被放在圆括号中
int
ival(1024);stringproject("Fantasia2001");
在这两种情况中ival
都被初始化为1024而project的初始值为Fantasia20002.6变量的定义变量定义可以位于程序中的任何地方2.6变量的定义允许直接使用结构体名定义变量
structstudent{
intno;floatmath;}studentwang;2.7强制类型转换强制转换类型C的强制类型转换法(类型名)表达式函数表示法(仅限简单类型)
类型名(表达式)
inti=int(1.35);动态内存分配(Dynamicmemoryallocation)静态与动态内存分配的两个主要区别是
静态对象是有名字的变量,直接对其进行操作。而动态对象是没有名字的变量,通过指针间接地对它进行操作。静态对象的分配与释放由编译器自动处理,程序员需要理解这一点,但不需要做任何事情。相反,动态对象的分配与释放必须由程序员显式地管理,相对来说比较容易出错它通过new
和delete
两个运算符来完成。2.8动态内存的分配与释放动态内存分配(Dynamicmemoryallocation)malloc(),calloc()和free().CC++2.8动态内存的分配与释放
new
运算符动态分配堆内存使用形式:
指针变量=new类型(常量); 指针变量=new类型[表达式
];
作用:从堆分配一块“类型”大小的存储空间,返回首地址
其中:“常量”是初始化值,可缺省
创建数组对象时,不能为对象指定初始值
delete
运算符释放已分配的内存空间使用形式:
delete指针变量;
delete[]指针变量;
其中:“指针变量”必须是一个new返回的指针2.8new和delete操作符int*p1=newint; char*p2=newchar;float*p3=newfloat;int*p4=newint[4];……deletep1;deletep2;deletep3;delete[]p4;2.8new和delete操作符int*p1=newint;char*p2=newchar;float*p3=newfloat;int*p4=newint[4];……deletep1;deletep2;deletep3;delete[]p4;p12.8new和delete操作符int*p1=newint;char*p2=newchar;float*p3=newfloat;int*p4=newint[4];……deletep1;deletep2;deletep3;delete[]p4;p1p22.8new和delete操作符int*p1=newint;char*p2=newchar;float*p3=newfloat;int*p4=newint[4];……deletep1;deletep2;deletep3;delete[]p4;p1p2p34.5.1new和delete操作符2.8new和delete操作符int*p1=newint;char*p2=newchar;float*p3=newfloat;int*p4=newint[4];……deletep1;deletep2;deletep3;delete[]p4;p1p2p3p44.5.1new和delete操作符2.8new和delete操作符int*p1=newint;char*p2=newchar;float*p3=newfloat;int*p4=newint[4];……deletep1;deletep2;deletep3;delete[]p4;p2p3p4p14.5.1new和delete操作符2.8new和delete操作符int*p1=newint;char*p2=newchar;float*p3=newfloat;int*p4=newint[4];……deletep1;deletep2;deletep3;delete[]p4;p2p3p4p14.5.1new和delete操作符2.8new和delete操作符int*p1=newint;char*p2=newchar;float*p3=newfloat;int*p4=newint[4];……deletep1;deletep2;deletep3;delete[]p4;p2p3p4p14.5.1new和delete操作符2.8new和delete操作符int*p1=newint;char*p2=newchar;float*p3=newfloat;int*p4=newint[4];……deletep1;deletep2;deletep3;delete[]p4;p3p4p2p12.8new和delete操作符int*p1=newint;char*p2=newchar;float*p3=newfloat;int*p4=newint[4];……deletep1;deletep2;deletep3;delete[]p4;p3p4p2p12.8new和delete操作符int*p1=newint;char*p2=newchar;float*p3=newfloat;int*p4=newint[4];……deletep1;deletep2;deletep3;delete[]p4;p4p2p1p32.8new和delete操作符int*p1=newint;char*p2=newchar;float*p3=newfloat;int*p4=newint[4];……deletep1;deletep2;deletep3;delete[]p4;p4p2p1p32.8new和delete操作符int*p1=newint;char*p2=newchar;float*p3=newfloat;int*p4=newint[4];……deletep1;deletep2;deletep3;delete[]p4;p2p1p3p42.8new和delete操作符int*p1=newint;char*p2=newchar;float*p3=newfloat;int*p4=newint[4];……deletep1;deletep2;deletep3;delete[]p4;p2p1p3p42.8new和delete操作符#include<iostream.h>voidmain(){int*p=NULL;p=newint(89); //初始化存储区
if(p==NULL) {cout<<"allocationfaiure\n";return;}
cout<<*p;deletep;}例用new算符建立简单对象2.8new和delete操作符#include<iostream.h>voidmain(){int*p=NULL;p=newint(89); //初始化存储区
if(p==NULL) {cout<<"allocationfaiure\n";return;}
cout<<*p;deletep;}p例用new算符建立简单对象2.8new和delete操作符#include<iostream.h>voidmain(){int*p=NULL;
p=newint(89);
//初始化存储区
if(p==NULL) {cout<<"allocationfaiure\n";return;}
cout<<*p;deletep;}p89例用new算符建立简单对象2.8new和delete操作符#include<iostream.h>voidmain(){int*p=NULL;p=newint(89); //初始化存储区
if(p==NULL)
{cout<<"allocationfaiure\n";return;}
cout<<*p;deletep;}p89例用new算符建立简单对象4.5.1new和delete操作符#include<iostream.h>voidmain(){int*p=NULL;p=newint(89); //初始化存储区
if(p==NULL) {cout<<"allocationfaiure\n";return;}
cout<<*p;deletep;}89对象无名只能通过指针访问例用new算符建立简单对象p892.8new和delete操作符#include<iostream.h>voidmain(){int*p=NULL;p=newint(89); //初始化存储区
if(p==NULL) {cout<<"allocationfaiure\n";return;}
cout<<*p;
deletep;}p8989例用new算符建立简单对象2.8new和delete操作符#include<iostream.h>voidmain(){int*p=NULL;p=newint(89); //初始化存储区
if(p==NULL) {cout<<"allocationfaiure\n";return;}
cout<<*p;
deletep;}8989例用new算符建立简单对象p2.8new和delete操作符#include<iostream.h>voidmain(){int*p=NULL,*t;inti;p=newint[10];if(p==NULL){cout<<"allocationfaiure\n";return;}for(i=0;i<10;i++)p[i]=100+i;
cout<<endl;for(t=p;t<p+10;t++)
cout<<*t<<"";
cout<<endl;delete[]p;}例用new算符建立动态数组2.8new和delete操作符#include<iostream.h>voidmain(){int*p=NULL,*t;inti;p=newint[10];if(p==NULL){cout<<"allocationfaiure\n";return;}for(i=0;i<10;i++)p[i]=100+i;
cout<<endl;for(t=p;t<p+10;t++)
cout<<*t<<"";
cout<<endl;delete[]p;}例用new算符建立动态数组pti2.8new和delete操作符#include<iostream.h>voidmain(){int*p=NULL,*t;inti;
p=newint[10];if(p==NULL){cout<<"allocationfaiure\n";return;}for(i=0;i<10;i++)p[i]=100+i;
cout<<endl;for(t=p;t<p+10;t++)
cout<<*t<<"";
cout<<endl;delete[]p;}例用new算符建立动态数组pti2.8new和delete操作符#include<iostream.h>voidmain(){int*p=NULL,*t;inti;p=newint[10];
if(p==NULL){cout<<"allocationfaiure\n";return;}for(i=0;i<10;i++)p[i]=100+i;
cout<<endl;for(t=p;t<p+10;t++)
cout<<*t<<"";
cout<<endl;delete[]p;}例用new算符建立动态数组pti2.8new和delete操作符#include<iostream.h>voidmain(){int*p=NULL,*t;inti;p=newint[10];if(p==NULL){cout<<"allocationfaiure\n";return;}
for(i=0;i<10;i++)p[i]=100+i;
cout<<endl;for(t=p;t<p+10;t++)
cout<<*t<<"";
cout<<endl;delete[]p;}例用new算符建立动态数组pti1001011021031041051061071081092.8new和delete操作符#include<iostream.h>voidmain(){int*p=NULL,*t;inti;p=newint[10];if(p==NULL){cout<<"allocationfaiure\n";return;}for(i=0;i<10;i++)p[i]=100+i;
cout<<endl;for(t=p;t<p+10;t++)
cout<<*t<<"";
cout<<endl;delete[]p;}例用new算符建立动态数组pt10i100101102103104105106107108109|2.8new和delete操作符#include<iostream.h>voidmain(){int*p=NULL,*t;inti;p=newint[10];if(p==NULL){cout<<"allocationfaiure\n";return;}for(i=0;i<10;i++)p[i]=100+i;
cout<<endl;
for(t=p;t<p+10;t++)
cout<<*t<<"";
cout<<endl;delete[]p;}例用new算符建立动态数组pt100101102103104105106107108109|10i#include<iostream.h>voidmain(){int*p=NULL,*t;inti;p=newint[10];if(p==NULL){cout<<"allocationfaiure\n";return;}for(i=0;i<10;i++)p[i]=100+i;
cout<<endl;for(t=p;t<p+10;t++)
cout<<*t<<"";
cout<<endl;delete[]p;}例用new算符建立动态数组pt100101102103104105106107108109|10i2.8new和delete操作符#include<iostream.h>voidmain(){int*p=NULL,*t;inti;p=newint[10];if(p==NULL){cout<<"allocationfaiure\n";return;}for(i=0;i<10;i++)p[i]=100+i;
cout<<endl;for(t=p;t<p+10;t++)
cout<<*t<<"";
cout<<endl;delete[]p;}例用new算符建立动态数组pt100101102103104105106107108109100|10i2.8new和delete操作符#include<iostream.h>voidmain(){int*p=NULL,*t;inti;p=newint[10];if(p==NULL){cout<<"allocationfaiure\n";return;}for(i=0;i<10;i++)p[i]=100+i;
cout<<endl;
for(t=p;t<p+10;t++)
cout<<*t<<"";
cout<<endl;delete[]p;}例用new算符建立动态数组pt100101102103104105106107108109100|10i2.8new和delete操作符#include<iostream.h>voidmain(){int*p=NULL,*t;inti;p=newint[10];if(p==NULL){cout<<"allocationfaiure\n";return;}for(i=0;i<10;i++)p[i]=100+i;
cout<<endl;for(t=p;t<p+10;t++)
cout<<*t<<"";
cout<<endl;delete[]p;}例用new算符建立动态数组pt100101102103104105106107108109100|10i2.8new和delete操作符#include<iostream.h>voidmain(){int*p=NULL,*t;inti;p=newint[10];if(p==NULL){cout<<"allocationfaiure\n";return;}for(i=0;i<10;i++)p[i]=100+i;
cout<<endl;for(t=p;t<p+10;t++)
cout<<*t<<"";
cout<<endl;delete[]p;}例用new算符建立动态数组pt100101102103104105106107108109100101|10i#include<iostream.h>voidmain(){int*p=NULL,*t;inti;p=newint[10];if(p==NULL){cout<<"allocationfaiure\n";return;}for(i=0;i<10;i++)p[i]=100+i;
cout<<endl;
for(t=p;t<p+10;t++)
cout<<*t<<"";
cout<<endl;delete[]p;}例用new算符建立动态数组p100101102103104105106107108109100101|t10i2.8new和delete操作符#include<iostream.h>voidmain(){int*p=NULL,*t;inti;p=newint[10];if(p==NULL){cout<<"allocationfaiure\n";return;}for(i=0;i<10;i++)p[i]=100+i;
cout<<endl;
for(t=p;t<p+10;t++)
cout<<*t<<"";
cout<<endl;delete[]p;}例用new算符建立动态数组p100101102103104105106107108109100101|t10i2.8new和delete操作符#include<iostream.h>voidmain(){int*p=NULL,*t;inti;p=newint[10];if(p==NULL){cout<<"allocationfaiure\n";return;}for(i=0;i<10;i++)p[i]=100+i;
cout<<endl;for(t=p;t<p+10;t++)
cout<<*t<<"";
cout<<endl;delete[]p;}例用new算符建立动态数组p100101102103104105106107108109100101|t10i2.8new和delete操作符#include<iostream.h>voidmain(){int*p=NULL,*t;inti;p=newint[10];if(p==NULL){cout<<"allocationfaiure\n";return;}for(i=0;i<10;i++)p[i]=100+i;
cout<<endl;for(t=p;t<p+10;t++)
cout<<*t<<"";
cout<<endl;delete[]p;}例用new算符建立动态数组p100101102103104105106107108109100101102|t10i2.8new和delete操作符#include<iostream.h>voidmain(){int*p=NULL,*t;inti;p=newint[10];if(p==NULL){cout<<"allocationfaiure\n";return;}for(i=0;i<10;i++)p[i]=100+i;
cout<<endl;
for(t=p;t<p+10;t++)
cout<<*t<<"";
cout<<endl;delete[]p;}例用new算符建立动态数组p100101102103104105106107108109100101102|t10i2.8new和delete操作符#include<iostream.h>voidmain(){int*p=NULL,*t;inti;p=newint[10];if(p==NULL){cout<<"allocationfaiure\n";return;}for(i=0;i<10;i++)p[i]=100+i;
cout<<endl;
for(t=p;t<p+10;t++)
cout<<*t<<"";
cout<<endl;delete[]p;}例用new算符建立动态数组p100101102103104105106107108109100101102|t10i2.8new和delete操作符#include<iostream.h>voidmain(){int*p=NULL,*t;inti;p=newint[10];if(p==NULL){cout<<"allocationfaiure\n";return;}for(i=0;i<10;i++)p[i]=100+i;
cout<<endl;for(t=p;t<p+10;t++)
cout<<*t<<"";
cout<<endl;delete[]p;}例用new算符建立动态数组p100101102103104105106107108109100101102|t10i2.8new和delete操作符#include<iostream.h>voidmain(){int*p=NULL,*t;inti;p=newint[10];if(p==NULL){cout<<"allocationfaiure\n";return;}for(i=0;i<10;i++)p[i]=100+i;
cout<<endl;for(t=p;t<p+10;t++)
cout<<*t<<"";
cout<<endl;delete[]p;}例用new算符建立动态数组p100101102103104105106107108109100101102103|t10i#include<iostream.h>voidmain(){int*p=NULL,*t;inti;p=newint[10];if(p==NULL){cout<<"allocationfaiure\n";return;}for(i=0;i<10;i++)p[i]=100+i;
cout<<endl;for(t=p;t<p+10;t++)
cout<<*t<<"";
cout<<endl;delete[]p;}例用new算符建立动态数组p100101102103104105106107108109100101102103104105106107108109|t10i2.8new和delete操作符#include<iostream.h>voidmain(){int*p=NULL,*t;inti;p=newint[10];if(p==NULL){cout<<"allocationfaiure\n";return;}for(i=0;i<10;i++)p[i]=100+i;
cout<<endl;for(t=p;t<p+10;t++)
cout<<*t<<"";
cout<<endl;delete[]p;}例用new算符建立动态数组p100101102103104105106107108109100101102103104105106107108109|t10i2.8new和delete操作符#include<iostream.h>voidmain(){int*p=NULL,*t;inti;p=newint[10];if(p==NULL){cout<<"allocationfaiure\n";return;}for(i=0;i<10;i++)p[i]=100+i;
cout<<endl;for(t=p;t<p+10;t++)
cout<<*t<<"";
cout<<endl;delete[]p;}例用new算符建立动态数组p100101102103104105106107108109100101102103104105106107108109|t10i2.8new和delete操作符#include<iostream.h>voidmain(){int*p=NULL,*t;inti;p=newint[10];if(p==NULL){cout<<"allocationfaiure\n";return;}for(i=0;i<10;i++)p[i]=100+i;
cout<<endl;for(t=p;t<p+10;t++)
cout<<*t<<"";
cout<<endl;
delete[]p;}例用new算符建立动态数组p100101102103104105106107108109100101102103104105106107108109|t10i2.8new和delete操作符#include<iostream.h>voidmain(){int*p=NULL,*t;inti;p=newint[10];if(p==NULL){cout<<"allocationfaiure\n";return;}for(i=0;i<10;i++)p[i]=100+i;
cout<<endl;for(t=p;t<p+10;t++)
cout<<*t<<"";
cout<<endl;
delete[]p;}例用new算符建立动态数组p100101102103104105106107108109100101102103104105106107108109|t10i2.8new和delete操作符#include<iostream.h>voidmain(){int*p=NULL,*t;inti;p=newint[10];if(p==NULL){cout<<"allocationfaiure\n";return;}for(i=0;i<10;i++)p[i]=100+i;
cout<<endl;for(t=p;t<p+10;t++)
cout<<*t<<"";
cout<<endl;delete[]p;}例用new算符建立动态数组p100101102103104105106107108109t10i2.8new和delete操作符#include<iostream.h>voidmain(){int*p=NULL,*t;inti;p=newint[10];if(p==NULL){cout<<"allocationfaiure\n";return;}for(i=0;i<10;i++)
p[i]=100+i;
cout<<endl;for(t=p;t<p+10;t++)
cout<<*t<<"";
cout<<endl;delete[]p;}例用new算符建立动态数组p100101102103104105106107108109t10i以下标方式访问动态数组2.8new和delete操作符#include<iostream.h>voidmain(){int*p=NULL,*t;inti;p=newint[10];if(p==NULL){cout<<"allocationfaiure\n";return;}for(i=0;i<10;i++)
p[i]=100+i;
cout<<endl;for(t=p;t<p+10;t++)
cout<<*t<<"";
cout<<endl;delete[]p;}例用new算符建立动态数组p100101102103104105106107108109t10ii是偏移量p
指针本身值不变2.8new和delete操作符#include<iostream.h>voidmain(){int*p=NULL,*t;inti;p=newint[10];if(p==NULL){cout<<"allocationfaiure\n";return;}for(i=0;i<10;i++)p[i]=100+i;
cout<<endl;for(t=p;t<p+10;t++)
cout<<*t<<"";
cout<<endl;delete[]p;}例用new算符建立动态数组p100101102103104105106107108109t10i跟踪指针赋初值2.8new和delete操作符#include<iostream.h>voidmain(){int*p=NULL,*t;inti;p=newint[10];if(p==NULL){cout<<"allocationfaiure\n";return;}for(i=0;i<10;i++)p[i]=100+i;
cout<<endl;for(t=p;t<p+10;t++)
cout<<*t<<"";
cout<<endl;delete[]p;}例用new算符建立动态数组p100101102103104105106107108109t10i跟踪指针移动2.8new和delete操作符#include<iostream.h>voidmain(){int*p=NULL,*t;inti;p=newint[10];if(p==NULL){cout<<"allocationfaiure\n";return;}for(i=0;i<10;i++)p[i]=100+i;
cout<<endl;for(t=p;t<p+10;t++)
cout<<*t<<"";
cout<<endl;delete[]p;}例用new算符建立动态数组p100101102103104105106107108109t10i间址访问元素2.8new和delete操作符#include<iostream.h>voidmain(){int*p=NULL,*t;inti;p=newint[10];if(p==NULL){cout<<"allocationfaiure\n";return;}for(i=0;i<10;i++)p[i]=100+i;
cout<<endl;for(t=p;t<p+10;t++)
cout<<*t<<"";
cout<<endl;delete[]p;}例用new算符建立动态数组p10010110210310410510610710810910ifor(i=0;i<10;i++){cout<<*p<<"";
p++;}注意结束循环后2.8new和delete操作符#include<iostream.h>voidmain(){int*p=NULL,*t;inti;p=newint[10];if(p==NULL){cout<<"allocationfaiure\n";return;}for(i=0;i<10;i++)p[i]=100+i;
cout<<endl;for(t=p;t<p+10;t++)
cout<<*t<<"";
cout<<endl;
delete[]p;}例用new算符建立动态数组p10010110210310410510610710810910ifor(i=0;i<10;p++)
cout<<*p<<"";注意结束循环后for(i=0;i<10;i++){cout<<*p<<"";
p++;}释放什么空间?2.8new和delete操作符#include<iostream.h>voidmain(){int*p=NULL,*t;inti;p=ne
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 家长如何应对孩子的网络欺凌问题论文
- 小学课间文明行为养成与德育课程整合研究论文
- 中国医药用酒石酸行业市场前景预测及投资价值评估分析报告
- 节假日工地管理制度
- 茶艺师培训管理制度
- 认知自动化在商务服务中
- 评估美国的医保体系
- 《一年级下册语文园地二》课件
- 李践有效提升销售的12大黄金法则1541497991
- 财会教材大全
- 2025年吉林省白城市大安市面向下半年应征入伍高校毕业生公开招聘事业单位人员5人历年高频重点提升(共500题)附带答案详解
- 前列腺增生小讲课
- UL1047标准中文版-2020绝缘电力系统设备UL标准中文版
- DB32T 2770-2015 活性炭纤维通 用技术要求与测试方法
- 2024-2030年中国酸枣行业市场销售模式及投资盈利预测报告
- 冶金企业电气安全
- 全国爱肝日-中国肝硬化临床诊治共识意见知识讲座
- 大数据调研报告
- 煤炭运输合同
- 2024年职业健康安全和环境管理目标、指标及管理方案
- 深圳市建筑小区及市政排水管网设计和施工技术指引
评论
0/150
提交评论