2021年3月20日
摘要: 10.10-1 #include<iostream>#include<string>using namespace std;class user{private://数据成员 string name; string account;//账号 double money;//存款 public://成员 阅读全文
posted @ 2021-03-20 10:03 HuJiao粉 阅读(24) 评论(0) 推荐(0)
2021年3月15日
摘要: 5.8-6 #include<iostream>int main(){ using namespace std; int i=1; while(i<=64) { cout<<i<<"、"; i=i*2; } cout<<endl; system("pause"); return 0;} 5.9-1 阅读全文
posted @ 2021-03-15 22:54 HuJiao粉 阅读(69) 评论(0) 推荐(0)
2021年3月13日
摘要: 程序清单5.3 #include<iostream>int main(){ using namespace std; int x; cout<<"The expression x = 100 has the value "; cout<<(x=100)<<endl; cout<<"Now x = " 阅读全文
posted @ 2021-03-13 22:04 HuJiao粉 阅读(107) 评论(0) 推荐(0)
2021年3月10日
摘要: 4.12-13 #include<iostream>#include<vector>#include<array>using namespace std;int main(){ cout<<"Entre a positive integer:"; unsigned int num; cin>>num 阅读全文
posted @ 2021-03-10 22:55 HuJiao粉 阅读(55) 评论(0) 推荐(0)
摘要: 如何使用不同形式的字符串 #include<iostream>#include<cstring>using namespace std;int main(){ char animal[20]="bear"; const char* bird="wren"; char* ps; cout<<anima 阅读全文
posted @ 2021-03-10 22:25 HuJiao粉 阅读(72) 评论(0) 推荐(0)
2021年3月9日
摘要: 取地址运算符&用法 #include<iostream>using namespace std;int main(){ int donuts=6; double cups=4.5; cout<<"donuts value = "<<donuts; cout<<" and donuts address 阅读全文
posted @ 2021-03-09 22:55 HuJiao粉 阅读(94) 评论(0) 推荐(0)
2021年3月8日
摘要: 在程序中使用结构 #include<iostream>using namespace std;struct inflatable{ char name[20]; float volume; double price;};int main(){ inflatable guest= { "Gloriou 阅读全文
posted @ 2021-03-08 22:43 HuJiao粉 阅读(57) 评论(0) 推荐(0)
2021年3月7日
摘要: 1 可以将string对象声明为简单变量,而不是数组 #include<iostream>#include<string>using namespace std;int main(){ char charr1[20]; char charr2[20]="jaguar"; string str1; s 阅读全文
posted @ 2021-03-07 22:56 HuJiao粉 阅读(49) 评论(0) 推荐(0)
摘要: 使用cin.getlint( ) #include<iostream>using namespace std;int main(){ const int ArSize=20; char name[ArSize]; char dessert[ArSize]; cout<<"Enter your nam 阅读全文
posted @ 2021-03-07 19:29 HuJiao粉 阅读(43) 评论(0) 推荐(0)
摘要: #include<iostream>using namespace std;int main(){ int yams[3]; yams[0]=7; yams[1]=8; yams[2]=6; int yamcosts[3]={20,30,5}; cout<<"Total yams = "; cout 阅读全文
posted @ 2021-03-07 16:39 HuJiao粉 阅读(53) 评论(0) 推荐(0)