| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 286 人关注过本帖
标题:三角形变换
只看楼主 加入收藏
一路看天
Rank: 1
来 自:广西
等 级:新手上路
帖 子:12
专家分:4
注 册:2012-11-26
结帖率:0
收藏
已结贴  问题点数:20 回复次数:3 
三角形变换
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
  int n,T;
  n=1;
  scanf("%d",&T);
  while(n<=T){
                      int r,h,k,a;
                      a=1;
                      int x1,x2,x3,y1,y2,y3;
                      scanf("%d%d%d\n",&r,&h,&k);
                      scanf("%d%d\n%d%d\n%d%d\n",&x1,&y1,&x2,&y2,&x3,&y3);
                      if(r/90==0){
                      x1=-y1;y1=x1;
                      x2=-y2;y2=x2;
                      x3=-y3;y3=x3;}
                      if(r/180==0){
                      x1=-x1;y1=-y1;
                      x2=-x2;y2=-y2;
                      x3=-x3;y3=-y3;}
                      if(r/270==0){
                      x1=y1;y1=-x1;
                      x2=y2;y2=-x2;
                      x3=y3;y3=-x3;}
                      if(r/360==0){
                      x1=x1;y1=y1;
                      x2=x2;y2=y2;
                      x3=x3;y3=y3;}
                      x1+=h;y1+=k;
                      x2+=h;y2+=k;
                      x3+=h;y3+=k;
                      printf("Case %d",a);
                      printf("%.2f%.2f\n%.2f%.2f\n%.2f%.2f\n",x1,y1,x2,y2,x3,y3);
                      a++;
                      n++;
                      }
  system("PAUSE");   
  return 0;
}
编译过了,就是没有输出,求助
搜索更多相关主题的帖子: include 三角形 
2012-12-16 23:16
wp231957
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
来 自:神界
等 级:贵宾
威 望:423
帖 子:13688
专家分:53332
注 册:2012-10-18
收藏
得分:7 
先说说你的程序想干嘛

DO IT YOURSELF !
2012-12-17 08:25
yaobao
Rank: 13Rank: 13Rank: 13Rank: 13
等 级:蒙面侠
威 望:4
帖 子:1854
专家分:4121
注 册:2012-10-25
收藏
得分:7 
楼主的代码我没有细看,但是在这里
        scanf("%d%d%d\n",&r,&h,&k);
       scanf("%d%d\n%d%d\n%d%d\n",&x1,&y1,&x2,&y2,&x3,&y3);
楼主存在两处错误,意识格式输入时与下面的格式输出类型不符,上面按整形输入,下面按浮点输出
第二个就是scanf里不需要换行符,以前我认为这样会吸收流里的回车符,将两个数合并成一个数输入,但是回帖前我又试了下,没有影响,起码是我在实验室没有发现。
楼主改一下输入或者输出格式应该可以输出了,至于输出的是不是楼主想要的我就不知道了


新手上路,请多关照

认认真真的学习,踏踏实实的走路:戒骄戒躁!!!
2012-12-17 08:49
daniel_
Rank: 5Rank: 5
等 级:职业侠客
帖 子:212
专家分:307
注 册:2012-11-13
收藏
得分:7 
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
  int n,T;
  n = 1;
  printf("please input a number:\n");
  scanf("%d",&T);
  while(n <= T){
                      int r,h,k,a;
                      a = 1;
                      int x1,x2,x3,y1,y2,y3;
                      printf("please input three numbers:\n");
                      scanf("%d%d%d",&r,&h,&k);
                      printf("please input six numbers:\n");
                      scanf("%d%d%d%d%d%d",&x1,&y1,&x2,&y2,&x3,&y3);

                      if(r/90 == 0){
                        x1=-y1;
                        y1=x1;
                        x2=-y2;
                        y2=x2;
                        x3=-y3;
                        y3=x3;
                      }
                      if(r/180 == 0){
                        x1=-x1;
                        y1=-y1;
                        x2=-x2;
                        y2=-y2;
                        x3=-x3;
                        y3=-y3;
                      }
                      if(r/270 == 0){
                        x1=y1;
                        y1=-x1;
                        x2=y2;
                        y2=-x2;
                        x3=y3;
                        y3=-x3;
                      }
                      if(r/360 == 0){
                        x1=x1;
                        y1=y1;
                        x2=x2;
                        y2=y2;
                        x3=x3;
                        y3=y3;
                      }

                      x1 += h;
                      y1 += k;
                      x2 += h;
                      y2 += k;
                      x3 += h;
                      y3 += k;

                      printf("Case a = %d\n",a);
                      printf("x1=%.2f y1=%.2f\nx2=%.2f y2=%.2f\nx3=%.2f y3=%.2f\n",x1,y1,x2,y2,x3,y3);
                      a++;
                      n++;
                      }
  system("PAUSE");   
  return 0;
}
----------------
不懂你的四个if是在干嘛
也不懂你的输入 有什么限制条件
so .....
what the hell are you want???????
2012-12-17 13:34
快速回复:三角形变换
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016300 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved