摘要: //#include"Program.h"#include<iostream> namespaceName{ usingnamespacestd; voidShowMsg(charmsg[]) { //cout<<msg<<endl; cout<<msg<<endl; }}intmain(){ usingnamespacestd; /*usingnamespaceName; ShowMsg("chinese");*/ Name::ShowMsg("chinese"); int 阅读全文
posted @ 2013-06-04 20:12 Predator 阅读(141) 评论(0) 推荐(0) 编辑
摘要: #include "Program.h"#include "ArrayTest.h"#include "Common.h"void ChangeDatasByRef(int &m,int &n);int main(){int datas[10]={10,1,2,3,4,5,6,7,8,9};ChangeArray(datas);cout<<"After Changed the Array"<<endl;//int len=GetMyArrayLen(datas);int le 阅读全文
posted @ 2013-06-04 19:59 Predator 阅读(316) 评论(0) 推荐(0) 编辑
摘要: #include "Program.h"#include "ArrayTest.h"#include "Common.h"void ChangeDatasByRef(int &m,int &n);int main(){int datas[10]={10,1,2,3,4,5,6,7,8,9};ChangeArray(datas);cout<<"After Changed the Array"<<endl;//int len=GetMyArrayLen(datas);int le 阅读全文
posted @ 2013-06-04 19:57 Predator 阅读(263) 评论(0) 推荐(0) 编辑
摘要: #include "Program.h"#include "ArrayTest.h"#include "Common.h"#define GETARRAYLEN(datas,len){ len = sizeof(datas)/sizeof(datas[0]);}//C语言获取数组长度的方法//C++语言获取数组长度的方法template<class T>int GetLength(T &datas){int len=sizeof(datas)/sizeof(datas[0]);return len;}int mai 阅读全文
posted @ 2013-06-04 19:26 Predator 阅读(218) 评论(0) 推荐(0) 编辑
摘要: string strMsg="Notify";//cout<<strMsg<<endl;//C++不允许直接将类型为string 输出strMsg.append("fu");char strName[20]="fan";//其余的都赋值为'\0';cout<<strName[5]<<endl;//int datas[20]={1,2};//整数数组初始化与字符数组初始化不一样,这样会报错strcat(strName,"fu");cout<< 阅读全文
posted @ 2013-06-04 19:25 Predator 阅读(120) 评论(0) 推荐(0) 编辑
摘要: #include "Program.h"int main(){int score=100;const int *pScore=&score;//不能通过*pScore更改score的数值,score = 400,pScore= &newValue还是可以的int newScore = 300;pScore=&newScore;//*pScore=300;score=200;cout<<score<<endl;//输出200;cout<<*pScore<<endl;//输出300;int result;c 阅读全文
posted @ 2013-06-04 19:24 Predator 阅读(182) 评论(0) 推荐(0) 编辑