program WriteStruct; {$APPTYPE CONSOLE} uses SysUtils; //写入结构体 type TCustomer = record ID: ]; Code: ]; Name: ]; end; var Customers: ..] of TCustomer; i: Integer; myText: file of TCustomer; //file of type type必须是固定大小的,不能是对象, String, Variant等 customer:
我定义了一个结构体,想要在函数中改变结构体的值,记录一下,以防忘记 ep: type Matrix struct{ rowlen int columnlen int list []int } 这是一个矩阵的结构体 函数传参格式 func main(){ var first Matrix func_name_you(&first) } func func_name_you(first *Matrix){ -- } 记得调用函数处要&+变量名 函数参数声明处要*+变量类型
#include <iostream> #include <string> using namespace std; struct CDAccount { double balance; //余额 double rate; //利息 int term; //存期 }; struct Date { int year; int month; int day; }; struct Person { string name; Date birthday; CDAccount account