摘要:
void newLine(istream& inStream = cin) //默认参数为cin { char symbol; do { inStream.get(symbol); }while(symbol != '\n'); } newLine(); newLine... 阅读全文
posted @ 2012-05-04 21:19
飞翔@骑士
阅读(212)
评论(0)
推荐(0)
摘要:
// fileStream.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <iostream> #include <fstream> #include <cstdlib> //退出 using namespace std; int main(int argc, char* argv[]) { ifstream inStream; ofstream outStream; ... 阅读全文
posted @ 2012-05-04 20:32
飞翔@骑士
阅读(73)
评论(0)
推荐(0)
摘要:
// 包含动态数组成员的类.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <iostream> #include <cstdlib> using namespace std; //此类的对象是一个部分填充的double类型的数组 class PFArrayD { public: PFArrayD(); PFArrayD(int capacityValue); PFA... 阅读全文
posted @ 2012-05-04 15:13
飞翔@骑士
阅读(150)
评论(0)
推荐(0)
摘要:
// 二维动态数组.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <iostream> using namespace std; typedef int* IntArrayPtr; int main(int argc, char* argv[]) { int d1 = 0, d2 = 0; cout <<"Enter the row and column dimensions of ... 阅读全文
posted @ 2012-05-04 14:05
飞翔@骑士
阅读(110)
评论(0)
推荐(0)
摘要:
//若希望一个函数返回一个数组,就必须声明为返回一个该数组基本类型的指针,并将该指针指向需要返回的数组。 // int[] someFunction() //非法 // int* someFunction() //合法 // 返回数组的函数.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <iostream> using namespace std; int* doubleArr(int arr... 阅读全文
posted @ 2012-05-04 13:45
飞翔@骑士
阅读(307)
评论(0)
推荐(0)
摘要:
避免悬空指针的方法是将所有悬空指针的变量都赋值为NULL 在进行*操作前,就可以通过判断该指针是否等于NULL的方式来检查指针变量 应该在delete操作符调用后,将悬空指针赋值为NULL 阅读全文
posted @ 2012-05-04 13:13
飞翔@骑士
阅读(616)
评论(0)
推荐(0)


浙公网安备 33010602011771号