结构体作为函数参数
一、值传递
#include <iostream>
#include <string>
using namespace std;
struct Student
{
int id;
string name;
float score[2];
};
void OutCome(Student s)
{
cout<<s.id<<','<<s.name<<','<<s.score[0]<<','<<s.score[1]<<end
#include <iostream>
#include <string>
using namespace std;
struct Student
{
int id;
string name;
float score[2];
};
void OutCome(Student s)
{
cout<<s.id<<','<<s.name<<','<<s.score[0]<<','<<s.score[1]<<end