编写自己的头文件
1、头文件TestCpp.h
#ifndef TESTCPP_H
#define TESTCPP_H
struct TestCpp{
std::string name;
unsigned int id;
};
#endif
2、主函数testTestCpp.cpp
#include <iostream>
#include "TestCpp.h"
int main()
{
TestCpp t1;
t1.name = "xiaoming";
t1.id = 20190203;
std::cout << "name: " << t1.name << std::endl;
std::cout << "id: " << t1.id << std::endl;
return 0;
}