| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 337 人关注过本帖
标题:程序能运行~但无按我的想法运行 C
只看楼主 加入收藏
theiswiner
Rank: 2
等 级:论坛游民
帖 子:15
专家分:10
注 册:2009-10-20
结帖率:100%
收藏
已结贴  问题点数:10 回复次数:3 
程序能运行~但无按我的想法运行 C
这是个计算温度的问题........
  程序能运行.
  但是不知道为什么 输入了时间之后 一按回车 就结束计算了~...分钟还没输入呢......而且.要是在第一个名称输入的时候 输入了3>个字符 程序也会自动结束的。。。。。。。希望各位大虾念在小弟孤苦无依..独自学习的艰辛...帮助下我0.0 不胜感激
  
  #include<stdio.h>
  
  main(void)
  {
   char first,middles,last;
   double t_b,
   T;
   double times_first,
   times_second;
  
   printf("Please type in 3 initials and press return>");
   scanf(" %c%c%c",&first,&middles,&last);
   printf("Helo %c%c%c,Let’s see the temperature in it.\n",first,middles,last);
   printf("The hour >");
   scanf(" %.2lf",&times_first);
   printf("The minutes >");
   scanf(" %.2lf",&times_second);
  
   t_b=times_first+(times_second/60);
   T=4*(t_b*t_b)/(t_b+2)-20;
  
   printf("\n The temperature in the freezer is %.2lf",T);
  
   return(0);
  }
  
搜索更多相关主题的帖子: 运行 
2009-10-20 15:03
m456m654
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:小飞侠
威 望:3
帖 子:783
专家分:2806
注 册:2009-9-17
收藏
得分:5 
#include<stdio.h> 
main(void)
{
char first,middles,last;
 float t_b,T;
 float times_first,times_second;  
 printf("Please type in 3 initials and press return>");
 scanf(" %c%c%c",&first,&middles,&last);
 printf("Helo %c%c%c,Let's see the temperature in it.\n",first,middles,last);
 printf("The hour >");
 scanf("%f",&times_first);  //在格式输入中不能限制小数的位数
 printf("The minutes >");
 scanf("%f",&times_second);
 t_b=times_first+(times_second/60);
 T=4*(t_b*t_b)/(t_b+2)-20;
 printf("\n The temperature in the freezer is %.2lf",T);
 return(0);
 }
2009-10-20 15:22
zqb7899
Rank: 4
等 级:业余侠客
帖 子:159
专家分:238
注 册:2009-10-16
收藏
得分:5 
给修改了一下,但不知你要求解的是什么。在WIN-TC下编译:
#include<stdio.h>  
main()
{
 char first,middles,last;
 double t_b,T;
 double times_first,times_second;
 printf("Please type in 3 initials and press return>");
 scanf("%c%c%c",&first,&middles,&last);
 printf("Helo %c%c%c,Let's see the temperature in it.\n",first,middles,last);
 printf("The hour >");
 scanf("%lf",&times_first);
 printf("The minutes >");
 scanf("%lf",&times_second);
 t_b=times_first+(times_second/60);
 T=4*(t_b*t_b)/(t_b+2)-20;
 printf("\nThe temperature in the freezer is %.2lf",T);
 getch();
}

2009-10-20 15:38
theiswiner
Rank: 2
等 级:论坛游民
帖 子:15
专家分:10
注 册:2009-10-20
收藏
得分:0 
感谢各位~!..
2009-10-20 18:36
快速回复:程序能运行~但无按我的想法运行 C
数据加载中...
 
   



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

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