A62724. 请你阅读以下这段C++程序,直接写出程序运行的结果。()#include<iostream>
填空题
知识点
题目描述
请你阅读以下这段C++程序,直接写出程序运行的结果。()
#include<iostream>
usingnamespace std;
int stk1[110], t1=0;
int stk2[110], t2=0;
voidfunc1(int x)
{
stk1[++t1]=x;
}
voidfunc2()
{
if(t2==0)
while(t1>0)
stk2 [++t2]=stk1[t1--];
if(t2>0)
t2--;
}
intmain()
{
func1(10);func1(20);func1(30);
func2();func1(40);
func2();func1(50);func1(60);
if(t1>0&&t2>0)
cout<<stk1 [t1]+stk2[t2];
else
cout<<-1;
return0;
}