0
点赞
收藏
分享

微信扫一扫

结构体就算不用构造函数也可以初始化


标题结构体就算不用构造函数也可以初始化

#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<set>
using namespace std;
struct stateAndLevel{
	string str;
	int level;
};

queue<stateAndLevel> q;
set<string> sc;
int n;


int main(){
	string src;
	string target;
	getline(cin,src);
	getline(cin,target);
	n=src.length();
	stateAndLevel first={src,0};				//通过这种方式即可初始化结构体
	return 0;
}


举报

相关推荐

0 条评论