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;
}
原文地址:https://www.cnblogs.com/komean/p/10350628.html
时间: 2024-10-17 23:39:01