struct date
{
int day;
int month;
int year;
void input()
{
std::cin>>day>>month>>year;
}
};
#include<iostream>
main()
{
date d1;
d1.input();
}
Run Code Online (Sandbox Code Playgroud)
cin除非包含iostream,否则无效.但是我们不能将结构声明为全局,除非我们在main函数之前定义它.
如何在我的struct中使用库函数.
| 归档时间: |
|
| 查看次数: |
45 次 |
| 最近记录: |