竞赛
考级
这道题涉及到了一个新概念: 结构体用struct定义,上代码吧
星舰♈
题解如下: 正经版: #include <bits/stdc++.h> using namespace std; struct stu{ string n; double ch; long long age; }x[1010]; int main() { x[1].n="张三"; x[1].ch=98.5; x[1].age=12; cout<<x[1].n<<" "<<x[1].ch<<" "<<x[1].age; return 0; } 骗分版: #include <bits/stdc++.h> using namespace std; int main() { cout<<"张三"<<" "<<"98.5"<<" "<<"12"; return 0; }
琮
#include<bits/stdc++.h> using namespace std; struct people{ string name; double x,old; }a={"张三",98.5,12}; int main(){ cout<<a.name<<" "<<a.x<<" "<<a.old; return 0; }
135****7623
题目要我们用结构体,当然不能用。
ACOI
#include<bits/stdc++.h> using namespace std; struct student{ string n="张三"; double c=98.5; int o=12; }; int main(){ student w; cout<<w.n<<" "<<w.c<<" "<<w.o<<endl; }
AC神
Arena Breakout
cos
#include<bits/stdc++.h> using namespace std; struct stu{ string name; double c; int t; }a[1005]; int main() { stu a; a.name="张三"; a.c=98.5; a.t=12; cout<<a.name<<" "<<a.c<<" "<<a.t; return 0; }
鬼影之魂
大家好,我又双叒叕来协体接纳(万恶的输入法) 这题可以直接cout,但介于这章是结构体,所以我们还是用结构体做。 也可以用cout做。
哇,我传伞太准了!
#include<iostream> using namespace std; struct stu{ string a="张三"; float trade=98.5; int age=12; }; int main(){ stu x; cout<<x.a<<" "<<x.trade<<" "<<x.age; return 0; }
乌云B612
#include<bits/stdc++.h> #define int long long using namespace std; signed main(){ cout<<"张三"<<" "<<98.5<<" "<<12; return 0; }
枫叶Lxy
continue
#include<iostream> using namespace std; int main(){ cout << "张三" << " " << 98.5 << " " << 12; return 0; }
༺ཌༀAC君 管理员~乔唐ༀད༻
欣沂
YuQing1919
Tian
面向结果编程
全明星_lloyd
无敌de鳖佬仔给老爷爷ccb
#include<iostream> #include<string> using namespace std; struct Sn_M_structs_eest_uvasxsz_XZAmdq__xzop{ string name; double cl; int age; }; int main(){ Sn_M_structs_eest_uvasxsz_XZAmdq__xzop a ={"张三",98.5,12}; cout<<a.name<<" "<<a.cl<<" "<<a.age; return 0; }
Arknights
YFT
共28条