第四章复习题

1、

1 char actors[30];
2 short betsic[100];
3 float chuck[13];
4 long double dipsea[64];

2、

1 array<char,30>actor;
2 array<short,100>bestic;
3 array<float,13>chuck;
4 array<long double,64>dipsea;

3、

int a[5]={1,3,5,7,9};

4、

1 int b=a[0]+a[4];

5、

1 cout<<ideas[1]<<endl;

6、

1 char b[]=”cheeseburger”;

7、

1 string c=”waldorf salad”;

8、

1 struct fish
2 {
3     string name;
4     int weight;
5     float length;
6 };

9、

1 fish a={“hjg”,15,415.2};

10、

1 enum response={no,tes,maybe};

11、

1 double *pt=&ted;
2 cout<<*pt;

12、

1 float treacle[10];
2 float *pn=treacle;
3 cout<<pn[0]<<pn[9];

13、

 1 #include<iostream>
 2 using namespace std;
 3 int main()
 4 {
 5     int i;
 6     cin>>i;
 7     int *pn=new int[i];
 8     delete pn;
 9     return 0;
10 }
 1 #include<iostream>
 2 #include<vector>
 3 using namespace std;
 4 int  main()
 5 {
 6     int i;
 7     cin>>i;
 8     vector<int>pn[i];
 9     return 0;
10 }

14、地址

15、

1 fish *pn=new fish;
2 cout<<pn->name<<pn->weight<<pn->length;

16、

17、

1 const int num=10;
2 #include<vector>
3 #include<array>
4 #include<string>
5 std::vector<std::string>pn[num];
6 std::array<std::string,num>pn;
原文地址:https://www.cnblogs.com/taoxiuxia/p/4137292.html