ITeye博客

C++的一些基本操作

J2EE大鸟 · 2013-03-10 01:32 · C语言 · 编程语言 · Markdown

#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;

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。