谁帮我把这程序在VS里调试下

来源:百度知道 编辑:UC知道 时间:2024/07/14 01:48:35
#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
const int N=50;
int w[N], h[N], t[N];
int len, i, j;
float count=0;

cin>>len;

for(i=0; i<len; i++)
cin>>w[i]>>h[i];
w[i+1]=0;
h[i+1]=h[i]+h[i-1];

t[0]=w[0];
t[1]=(w[0]+w[1]+w[2])*(h[1]+1-h[0])-(h[1]-h[0])*w[1]-(h[2]-h[0])*w[2];
count=w[0];

for(j=2; j<len; j++)
{
count += w[j-1];
if(j%2)
t[j]=t[j-2]+(h[j]-h[j-2]-1)*count+(h[j]-h[j+1])*w[j+1]+count+w[j]+w[j+1];
else
t[j]=t[j-1]-count-(h[j-1]-h[j])*w[j];
}

for(i=0; i<len; i++)
cout<<t[i]<<endl;

system("PAUSE");
return EXIT_SUCCESS;
}
在dev-c上运行出来了 vs

这样贴一堆空洞的代码在这里,你又不是Linus Torvalds,除了那些对积分极度饥渴的BT,没有人愿意通过阅读这些玩具代码来理解你的逻辑。这只有靠你用文字叙述,最起码你要说明整个程序的意图和一些实现步骤的大概描述。