编译不过,求帮忙

P1104 生日

}```cpp #include <bits/stdc++.h> using namespace std; struct P{ string name; int s,y,m,d; }c[1001]; bool cmp(P a,P b){ if (a.y!=b.y){ if (a.m!=b.m ){ if (a.d!=b.d){ return a.s>b.s; }else{ return a.d<b.d; } }else{ return a.m<b.m; } }else{ return a.y<b.y; } } int main(){ int n; cin>>n; for(int i=0;i<n;i++){ cin>>c.name>>c.y>>c.m>>c.d; c[i].name=i; } sort(c,c+n+1,cmp); for(int i=0;i<n;i++){ cout<<c[i].name<<endl; } return 0; } ```
by Duchengyu @ 2022-11-16 20:43:24


不会用代码格式,将就着看一看吧
by Duchengyu @ 2022-11-16 20:44:10


内个首先你得include没有# 其次c是数组不能直接cin>>c.name……之类的 最后建议学习怎么使用代码格式不然以后没人帮你改
by SJH_qwq @ 2022-11-16 20:48:11


@[songjiahao_](/user/761125) #应该是有的,否则不太可能被markdown渲染成一级标题
by Vanishing_Stars @ 2022-11-16 20:49:24


@[Duchengyu](/user/580836) 忽略第一条因为你的#加了空格导致没有显示而变成了H!字体
by SJH_qwq @ 2022-11-16 20:49:36


@[Vanishing_Stars](/user/786586) 对的,我傻了(
by SJH_qwq @ 2022-11-16 20:50:05


代码格式只要在代码头尾加上三个```就行了
by China_Dream_Lucy @ 2022-11-16 20:52:33


如: \`\`\` #include<bits/stdc++.h> using namespace std; int main(){ } \`\`\` 效果为: ``` #include<bits/stdc++.h> using namespace std; int main(){ } ```
by China_Dream_Lucy @ 2022-11-16 20:55:14


具体可以看[这](https://www.luogu.com.cn/blog/luogu/how-to-use-markdown)
by China_Dream_Lucy @ 2022-11-16 20:58:09


懂了,谢谢大佬们
by Duchengyu @ 2022-11-17 19:15:14


|