题目地址:参数解析 重点是要意识到利用flag来区别处理在“”内外的字符

#include<iostream>
#include<vector>
#include<string>
using namespace std;

int main(){
	string str,stt;
	int i=0;
	bool flag = 0;
	vector<string> arr;
	while (getline(cin, str)){
		for (int i = 0; i < str.size(); ++i){
			if (str[i] == '"'){
				flag = ~flag;
			}
			else{
				if (str[i] == ' ' && flag==0){
					arr.push_back(stt);
					stt = "";
				}
				else{
					if (str[i]!='"')
					stt += str[i];
				}
			}
		}
		arr.push_back(stt);
		cout << arr.size() << endl;
		for (int i = 0; i < arr.size(); i++){
			cout << arr[i] << endl;
		}
	}
	return 0;
}