1、
C++ primer plus 中文版 第六版 源代码
第二章到第四章,后续继续更新………
第二章
1:#include 2、< 3、tonetolb(int sts)
{
return 14*sts;
}
3:#include 4、rots."< 5、ing namespace std;
simon(3);
cout<<"Pick an integer: ";
int count;
cin>>count;
simon(count);
cout<<"Done !"< 6、in()
{
using namespace std;
double area;
cout<<"Enter the floor arae,in square feet,of your home: ";
cin>>area;
double side;
side=sqrt(area);
cout<<"That's the equivalent of a square "< 7、 第三章
1:#include 8、< 10、nd sue has "< 11、ue has "< 12、
cout<<"waist = "< 13、decimal for 42)"< 14、out<<"Enter your agent code:__________\b\b\b\b\b\b\b\b";
long code;
cin>>code;
cout<<"\aYou entered "< 15、
cout<<"Hola! ";
cout<<"Thank you for the "< 16、he ASCII code for "< 17、t tub=10.0/3.0;
double mint=10.0/3.0;
const float million=1.0e6;
cout<<"tub = "< 20、eads< 21、t<<"double constants:1.e7/9.0 = ";
cout<<1.e7/9.0< 22、lbs/Lbs_per_stn;
int pounds=lbs%Lbs_per_stn;
cout< 23、cout<<"tree = "< 24、 = "< 25、[0]=7;
yams[1]=8;
yams[2]=6;
int yamcosts[3]={20,30,5};
cout<<"Total yams = ";
cout< 26、costs[2];
cout<<"The total yam expense is "< 27、har name1[size];
char name2[size]="C++owboy";
cout<<"Howdy! I'm "< 28、"< 29、<<"Enter your favorite dessert:\n";
cin>>dessert;
cout<<"I have some delicious "< 30、 cin.getline(name,arsize);
cout<<"Enter your favorite dessert:\n";
cin.getline(dessert,arsize);
cout<<"I have some delicious "< 31、ssert[arsize];
cout<<"Enter your name:\n";
cin.get(name,arsize).get();
cout<<"Enter your favorite dessert:\n";
cin.get(dessert,arsize);
cout<<"I have some delicious "< 32、 main()
{
char charr1[20];
char charr2[20]="jaguar";
string str1;
string str2="panther";
cout<<"Enter a kind of feline: ";
cin>>charr1;
cout<<"Enter another kind of feline: ";
cin>>str1;
cout<<"Here are some felines:\n";
cout< 33、ndl;
cout<<"The third letter in "< 34、object to another:s2=s1\n";
s2=s1;
cout<<"s1: "< 35、
cout<<"You can append strings.\n";
s1+=s2;
cout<<"s1+=s2 yields s1= "< 37、ains "
< 38、 "
< 39、"
< 40、
29.99
};
inflatable pal=
{
"Audacious Arthur",
3.12,
32.99
};
cout<<"Expand your guest list with "< 41、11:#include 42、hoice=bouquet;
cout<<"choice: "< 43、 "Godzilla",2000,565.99 }
};
cout<<"The guests "< 44、
cout<<"donuts valus = "< 45、alue:updates = "< 47、
cin>>temp;
char *pn=new char[strlen(temp)+1];
strcpy(pn,temp);
return pn;
}
16:#include 48、"<<*pw< 49、\n";
cout<<"stacks[0]= "< 50、return 0;
}
17://指针和数组的真正区别
#include
using namespace std;
void main()
{
char ch;
cout<<"Enter a character:"<
©2010-2025 宁波自信网络信息技术有限公司 版权所有
客服电话:4009-655-100 投诉/维权电话:18658249818