C语言画平行四边形

pingheng74 2014-07-22 09:48:57
#include "stdio.h"

struct po
{
int x;
int y;
};


int main()
{
int i;
po p[4];
while (i=0;i<4;i++)
{
printf ("Please input %d x.",i);
scanf ("%d",&p[i].x);
printf ("Please input %d Y.",i);
scanf ("%d",&p[i].y);
if (p[0].x-p[1].x==p[3].x-p[2].x)
{
if (p[0].y-p[1].y==p[3].y-p[2].y)
printf ("The pingxingsibianxing cun zai!!!");
else
printf ("Cannot output pingxingsibianxing");
}
else
printf ("Cannot output pingxingsibianxing");
}
getchar ();
}




In function 'int main()':
[Error] expected ')' before ';' token
[Error] expected ';' before ')' token
[Error] expected '}' at end of input

运行时报错的。大侠们能帮小弟找出原因吗?谢谢了!
...全文
945 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
LS问题已解决
dataxdata 2014-07-23
  • 打赏
  • 举报
回复
引用 4 楼 pingheng74 的回复:
这里为什么用while是错误的,要改为for???
while的语法不是这样的啊,你回去找本书看看
pingheng74 2014-07-23
  • 打赏
  • 举报
回复
引用 4 楼 pingheng74 的回复:
[quote=引用 2 楼 dataxdata 的回复:]
这句
while (i=0;i<4;i++)不是这么写的
应该写成
for(i=0;i<4;i++)


这里为什么用while是错误的,要改为for???[/quote]

当用“while”时为啥会这样报错?请大侠帮忙解释下!
In function 'int main()':
[Error] expected ')' before ';' token
[Error] expected ';' before ')' token
[Error] expected '}' at end of input

pingheng74 2014-07-23
  • 打赏
  • 举报
回复
引用 2 楼 dataxdata 的回复:
这句 while (i=0;i<4;i++)不是这么写的 应该写成 for(i=0;i<4;i++)
这里为什么用while是错误的,要改为for???
dataxdata 2014-07-22
  • 打赏
  • 举报
回复
这句 while (i=0;i<4;i++)不是这么写的 应该写成 for(i=0;i<4;i++)
lhy 2014-07-22
  • 打赏
  • 举报
回复
你的函数名到括号之间有个空格,要去掉。

13,822

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder相关内容讨论区
社区管理员
  • 基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧