---
title: "C++的一些基本操作"
author: "J2EE大鸟"
date: "2013-03-10T01:32:53Z"
tags: []
categories: ["编程语言"]
slug: "c"
draft: false
lastmod: "2013-03-10T01:32:53Z"
id: 1826981
url: "https://benworld.iteye.com/blog/1826981"
---

```
#include<stdio.h>
#include<string>
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<algorithm>
using namespace std;
bool compare(const String & s1,const String & s2)
{
	return s1<s2;
}
bool com(const char & c1,const char & c2)
{
	return c1<c2;
}
int main(){
//	char a[5]="asd1";
//	char b[5]="asd3";
//	if(strcmp(a, b) < 0){printf("ok");}
	vector<string> save;
	for(int i=0;i<5;i++){
		string tmp;
		cin>>tmp;
		save.push_back(tmp);
	}
	for(vector<string>::iterator iter = save.begin(); iter!=save.end();iter++)
		cout<<(*iter)<<endl;

	sort(save.begin(),save,end(),compare);
	char haha[100];
	sort(haha,haha+100,com);

	queue<string> q;
	string s;
	cin>>s;
	q.push(s);
	string a = q.front();
	q.pop();

	stack<string> st;
	st.push(s);
	s = st.top();
	st.pop();
	return 0;
```