这是我想要做的:
#include <iostream>
void out(box boxx);
struct box {
char charr;
float floatt;
};
int main()
{
box boxx;
boxx.charr = 'f';
boxx.floatt = 2.5;
out(boxx);
}
void out(box boxx)
{
std::cout << boxx.charr << "\n" << boxx.floatt;
}
我想制作一个从结构中打印数据的函数。