- 1、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
第2讲 变量与数据.ppt
* #include iostream #include string using namespace std; string getSubStr(const string str,size_t iPos) { string strSubStr; if(str.size()iPos) { throw logic_error(iPos is too large); } strSubStr=str.substr(iPos); return strSubStr; } int main() { string s1(hello); coutgetSubStr(s1,3); return 0; } * #include iostream #include iomanip using namespace std; static int count=0;//全局变量 int main() { for( int i=0; i9; i++) { // do something } // some code for( int i=0; i9; i++) { // do another thing } return 0; * #include iostream using namespace std; int put(int n); int vals[10]; int error=-1; void main() { put(0)=10; //ò?put(0)oˉêy?μ×÷?a×ó?μ£?μè??óúvals[0]=10; put(9)=20; //ò?put(9)oˉêy?μ×÷?a×ó?μ£?μè??óúvals[9]=20; coutvals[0]; coutvals[9]; } int put(int n) { if (n=0 n=9 ) return vals[n]; else { coutsubscript error; return error; } } * #include iostream #include string using namespace std; void Array_test1(int(array)[3]) { array[2]=3; } void Array_test2(int array[3]) { array[2]=3; } int main() { int n3[2]={2,4}; Array_test1(n3); Array_test2(n3); } * #include iostream #include string using namespace std; void Array_test1(int(array)[3]) { array[2]=3; } void Array_test2(int array[3]) { array[2]=3; } int main() { int n3[2]={2,4}; Array_test1(n3); Array_test2(n3); } * #include iostream #include iomanip using namespace std; int main() { int a; int b=a; const int c=12.3; coutc; short s=123; const int rIntegrate=s; s=321; const int *ip=rIntegrate; coutrIntegrate=rIntegrate,s=sendl; coutip=ip,s=s; return 0; } * using namespace std; int main(int argc,char* argv[]) { PSTR piVar1,piVar2; PSTR_MACRO piVar3,piVar4; char iVar=100; piVar1=iVar; piVar2=iVar; piVar3=iVar; piVar4=iVar; cout(void*)piVar1endl; cout(void*)piVar2endl; cout(void*)piVar3endl; coutpiVar4endl; return 0; } * #include iostream typedef int* PTR_INT1; #def
您可能关注的文档
最近下载
- 金属非金属矿山重大事故隐患判定标准-尾矿库.pptx VIP
- 解读金属非金属露天矿山重大事故隐患判定标准.pptx VIP
- 清华大学航空应用产业研究院建设方案讨论稿.pptx VIP
- 《如何上好一堂数学课》新教师数学教学培训PPT课件(2025).pptx VIP
- 金属非金属矿山重大事故隐患判定标准解读.pptx VIP
- 2025年成都天府一街初一入学语文分班考试真题含答案.docx VIP
- 2025年成都铁中府河小升初入学分班考试语文考试试题及答案.docx VIP
- 搭建产业技术研发和转化平台方案.docx VIP
- 产业技术研究院(新型研发机构)筹建方案.docx VIP
- 高一三角函数习题(含答案).doc VIP
文档评论(0)