#include<iostream>
#include<array>
#include<vector>
int main(){
// ini
using namespace std;
cout.setf(ios_base::fixed,ios_base::floatfield);
// starts
// 1
char actor[30];
short betsie[100];
float chuch[13];
long double dipsea[64];
// 2
array<char,30> actor1;
array<short,100> betsie1;
array<float,13> chuch1;
array<long double,64> dipsea1;
// 3
int ji[5]={1,3,5,7,9};
// 4
int even;
even = ji[0];
even = ji[4];
// 5
float ideas[4] = {0,2.1,3.4,5.55};
cout<<ideas[1]<<endl;
// 6
char cheese[13] = "cheeseburger";
// 7
string wald = "Waldof Salad";
// 8
struct fish{
char variety[20];
int weight;
double length;
}; // 结构体声明后别忘记加“;”
// 9
fish butterfish = {"butterfish",10,22.5};
// 10
enum Response{Yes=1,No=0,Maybe=2};
// 11
double ted = 2.45;
double *p = &ted;
cout<<*p<<endl;
// 12
float treacle[10]={1.1,0,0,0,0,0,0,0,0,9.9};
float *p1 = &treacle[0]; // float *p1 = treacle;
cout<<*p1<<" "<<*(p1+9)<<endl;
// 13
cout<<"请输入一个正整数:";
int n;
cin>>n;
int *a1 = new int[n];
vector<int> a2(n);
// 14 输出该字符串首地址
cout<<(int*) "Home of the jolly bytes"<<endl;
// 15
fish *f1 = new fish;
cout<<"input variety:"<<endl;
cin>>f1->variety;
cout<<"input weight:"<<endl;
cin>>f1->weight;
cout<<"input length:"<<endl;
cin>>f1->length;
cout<<"variety: "<<f1->variety<<"\n"<<"weight: "<<f1->weight<<"\n"<<f1->length<<endl;
// 16 输入不再因换行出问题
int year;
cin>>year;
char address[80];
cin>>address;
cout<<year<<endl;
cout<<address<<endl;
// 17
const int num = 10;
std::vector<string> s1(num);
std::array<string,num> s2;
// getchar();
// getchar();
return 0;
}
#include
#include
#include
int main(){
// ini
using namespace std;
cout.setf(ios_base::fixed,ios_base::floatfield);
// starts
// 1
char actor[30];
short betsie[100];
float chuch[13];
long double dipsea[64];
// 2
array<char,30> actor1;
array<short,100> betsie1;
array<float,13> chuch1;
array<long double,64> dipsea1;
// 3
int ji[5]={1,3,5,7,9};
// 4
int even;
even = ji[0];
even = ji[4];
// 5
float ideas[4] = {0,2.1,3.4,5.55};
cout<<ideas[1]<<endl;
// 6
char cheese[13] = “cheeseburger”;
// 7
string wald = “Waldof Salad”;
// 8
struct fish{
char variety[20];
int weight;
double length;
}; // 结构体声明后别忘记加“;”
// 9
fish butterfish = {“butterfish”,10,22.5};
// 10
enum Response{Yes=1,No=0,Maybe=2};
// 11
double ted = 2.45;
double *p = &ted;
cout<<*p<<endl;
// 12
float treacle[10]={1.1,0,0,0,0,0,0,0,0,9.9};
float *p1 = &treacle[0]; // float *p1 = treacle;
cout<<p1<<" "<<(p1+9)<<endl;
// 13
cout<<“请输入一个正整数:”;
int n;
cin>>n;
int a1 = new int[n];
vector a2(n);
// 14 输出该字符串首地址
cout<<(int) “Home of the jolly bytes”<<endl;
// 15
fish *f1 = new fish;
cout<<“input variety:”<<endl;
cin>>f1->variety;
cout<<“input weight:”<<endl;
cin>>f1->weight;
cout<<“input length:”<<endl;
cin>>f1->length;
cout<<“variety: “<variety<<”\n”<<“weight: “<weight<<”\n”<length<<endl;
// 16 输入不再因换行出问题
int year;
cin>>year;
char address[80];
cin>>address;
cout<<year<<endl;
cout<<address<<endl;
// 17
const int num = 10;
std::vector s1(num);
std::array<string,num> s2;
// getchar();
// getchar();
return 0;
}