请问
#include<iostream>
#include<cmath>
using namespace std;
const double PI=3.14;
double r;
double V1;
double V2(double PI,double r,double V1)
{
cin>>r;
V1=PI*3/4*pow(r,3);
cout<<V2;
}
int main()
{
V2();
return 0;
}
怎么该?
#include<iostream>
#include<cmath>
using namespace std;
const double PI=3.14;
double r;
double V1;
double V2()
{
cin>>r;
V1=PI*3/4*pow(r,3);
cout<<V1;
}
int main()
{
V2();
return 0;
}
#include<iostream>
using namespace std;
struct stack
{
int top;
char elem[20];
};
void initstack(stack *lsy)
{
lsy->top=-1;
}
void push(stack *lsy,char e)
{
lsy->top++;
lsy->elem[lsy->top]=e;
}
bool pop(stack *lsy)
{
if(lsy->top==-1)
{
return false;
}
else
{
lsy->top--;
return true;
}
}
char gettop(stack *lsy,char e)
{
if(lsy->top==-1)
{
return 0;
}
else
{
e=lsy->elem[lsy->top];
return e;
}
}
int main()
{
stack *lsy;
lsy=new stack;
initstack(lsy);
char ch[20],e;
cin>>ch;
for(int i=0;;i++)
{
if(ch[i]=='#')
break;
switch(ch[i])
{
case '(':
case '[':
case '{':
push(lsy,ch[i]);
break;
case ')':
case ']':
case '}':
if(lsy->top==-1)
{
cout<<"0";
return 0;
}
else
{
e=gettop(lsy,e);
if(ch[i]-e==1||ch[i]-e==2)
{
pop(lsy);
}
else
{
cout<<"0";
return 0;
}
}
}
}
if(lsy->top==-1)
cout<<"1";
else
cout<<"0";
return 0;
}