以A,B,C三个表中都会有这个元素。那么用指针遍历A表,用另外两个指针遍历B,C。查找B,C中同A的元素,因为3个表都是有序的,可以采用些简单的比较。找到后删除。
2:void AE(stack &s)
{
int stack (s); //得到传递过来的栈
push(s,3); // 3进栈
push(s,4); // 4进栈
int x=pop(s)+2*pop(s); // x = 3 + 2 * 4
push(s,x); // x 进栈
int a[5]=;
for(j=0;j<5;j++)
push(s,a[i]) // A数组进栈
while(!stackempty(s)) // 直到栈空
printf("%d",2*pop(s)); //输出 2*栈中每个元素
结果自己想了。
以A,B,C三个表中都会有这个元素。那么用指针遍历A表,用另外两个指针遍历B,C。查找B,C中同A的元素,因为3个表都是有序的,可以采用些简单的比较。找到后删除。
2:void AE(stack &s)
{
int stack (s); //得到传递过来的栈
push(s,3); // 3进栈
push(s,4); // 4进栈
int x=pop(s)+2*pop(s); // x = 3 + 2 * 4
push(s,x); // x 进栈
int a[5]=;
for(j=0;j<5;j++)
push(s,a[i]) // A数组进栈
while(!stackempty(s)) // 直到栈空
printf("%d",2*pop(s)); //输出 2*栈中每个元素
结果自己想了。
另外,虚机团上产品团购,超级便宜