晨三娃


私信TA

用户名:13008142306

访问量:21034

签 名:

我的语言,没有对象

等  级
排  名 385
经  验 4964
参赛次数 6
文章发表 28
年  龄 20
在职情况 学生
学  校 西华大学
专  业 计算机科学与技术

  自我简介:

#include <iostream>

using namespace std;

struct student{

string number;

string name;

float score[3];

};

int main ()

{

int n;

cin>>n;

student *p=new student [n];

for(int i=0;i<n;i++){

cin>>(*(p+i)).number;

cin>>(*(p+i)).name;

for(int j=0;j<3;j++)

cin>>(*(p+i)).score[j];

}

for(int i=0;i<n;i++){

cout<<(*(p+i)).number<<',';

cout<<(*(p+i)).name<<',';

for(int j=0;j<3;j++){

cout<<(*(p+i)).score[j];

if(j<2) cout<<',';

}

cout<<endl;

}

return 0;

}


 

0.0分

5 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换

万能编程问答

代码解释器

  评论区