下列代码是旧式 C++程序,将它按自己的编程风格编排,转换成标准C++,能简化就简化,并写出运行结果(可以添加头部注择)。
#include<iostream.h>
void main()
{
int a, b,c;
int s, w,t;
s=w=t=0;
a=-1;
b=3;
c=3;
if(c<0)
s=a+b;
if(a<=0)
{
if(b>0)
if(c<=0)
w=a-b;
}
else
if(c>0)
w=a-b;
else
t=c;
cout<<s<<' , '
<<w<<' , '
<<t<<endl;
} 
//----------------------------------- //EX0407.cpp //改写C++代码 //----------------------------------- #include<iostream> using namespace std; //----------------------------------- int main() { int a=-1, b=3, c=3; int s, w=0, t=0; s = (c<0 ? a+b : 0); if(a<=0) w = (b<0 && c<=0 ? a-b : 0); else c>0 ? w=a-b : t=c; cout<<s<<','<<w<<','<<t<<"\n"; }//----------------------------------