user-0 提问: 并集怎么写？？？

回复:
user: user-1
content: 仅供参考：#include <algorithm> #include <iostream> #include <functional> #include <cstring> using namespace std; int main() {     char *Alphabet = "abcdefghijklmnopqrstuvwxyz" ;     char *Vowels   = "aeiou" ;     char *AlphaNum = "0123456789abcdef" ;     char result[45] ;     char *last ;      int lenA  = strlen(Alphabet) ;     int lenV  = strlen(Vowels  ) ;     int lenAN = strlen(AlphaNum) ;      cout << "Alphabet = " << Alphabet << endl ;     cout << "Vowels   = " << Vowels   << endl ;     cout << "AlphaNum = " << AlphaNum << endl ;      cout << "\nusing non-predicate versions" << endl ;      //non-predicate set_difference     last = set_difference(Alphabet, Alphabet+lenA,                           AlphaNum, AlphaNum+lenAN,                           result) ;     *last = 0 ;     cout << "set_difference(Alphabet, AlphaNum) =  " << result << endl ;      //non-predicate set_intersection     last = set_intersection(Alphabet, Alphabet+lenA,                             AlphaNum, AlphaNum+lenAN,                             result) ;     *last = 0 ;     cout << "set_intersection(Alphabet, AlphaNum) =  " << result << endl ;      //non-predicate set_symmetric_difference     last = set_symmetric_difference(Alphabet, Alphabet+lenA,                                     Vowels  , Vowels  +lenV,                                     result) ;     *last = 0 ;     cout << "set_symmetric_difference(Alphabet, Vowels) =  " << result << endl ;      //non-predicate set_union     last = set_union(Alphabet, Alphabet+lenA,                      AlphaNum, AlphaNum+lenAN,                      result) ;     *last = 0 ;     cout << "set_union(Alphabet, AlphaNum) =  " << result << endl ;      cout << "\nusing predicate versions" << endl ;      //predicate set_difference     last = set_difference(Alphabet, Alphabet+lenA,                           AlphaNum, AlphaNum+lenAN,                           result  , less<char>()) ;     *last = 0 ;     cout << "set_difference(Alphabet, AlphaNum) =  " << result << endl ;      //predicate set_intersection     last = set_intersection(Alphabet, Alphabet+lenA,                             AlphaNum, AlphaNum+lenAN,                             result  , less<char>()) ;     *last = 0 ;     cout << "set_intersection(Alphabet, AlphaNum) =  " << result << endl ;      //predicate set_symmetric_difference     last = set_symmetric_difference(Alphabet, Alphabet+lenA,                                     Vowels  , Vowels  +lenV,                                     result  , less<char>()) ;     *last = 0 ;     cout << "set_symmetric_difference(Alphabet, Vowels) =  " << result << endl ;      //predicate set_union     last = set_union(Alphabet, Alphabet+lenA,                      AlphaNum, AlphaNum+lenAN,                      result  , less<char>()) ;     *last = 0 ;     cout << "set_union(Alphabet, AlphaNum) =  " << result << endl ;      return 0 ; }

user: user-2
content: #include<stdio.h> int main() { 	int a[100],b[100],c[100]; 	int i,j; 	int m=0,n=0; 	int k=0,x=0; 	bool d; 	printf("请输入数组A：\n"); 	for(i=0;i<=100;i++) 	{ 		scanf("%d",&a[i]); 		if(a[i]<0) 			break; 		m++; 	}        	printf("请输入数组B：\n"); 	for(i=0;i<=100;i++) 	{ 		scanf("%d",&b[i]); 		if(b[i]<0) 			break; 		n++; 	} 	printf("A,B交集:"); 	for(i=0;i<m;i++) 	{ 		for(j=0;j<n;j++) 		{ 			if(a[i]==b[j]) 			{    				printf("%d ",a[i]); 			} 		} 	} 	printf("A,B并集: "); 	for(i=0;i<m;i++) 	{ 		printf("%d ",a[i]); 	} 	for(j=0;j<n;j++) 	{ 		d = true; 		for(i=0;i<m;i++) 		{    			if (a[i] == b[j]) 			{ 				d = false; 				break; 			} 		} 		if (d) 			printf("%d ",b[j]); 	} }

user: user-2
content: 思路：先输出a中的，然后扉b中各数，若该数在a中没有，就输出

user: user-3
content: http://blog.sina.com.cn/s/blog_616e189f0100mrdn.html