| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 530 人关注过本帖
标题:新手使用win-tc时,遇到一个问题,求解???
只看楼主 加入收藏
冯志强采桑子
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2013-4-11
结帖率:50%
收藏
已结贴  问题点数:20 回复次数:5 
新手使用win-tc时,遇到一个问题,求解???
/* Program 2.8 calculations on a table */
#include <stdio.h>

int main(void)
{

  float radius = 0.0f; /*The radius of the table */
  float diameter = 0.0f; /*The diameter of the table */
  float circumference = 0.0f;   /*The circumference of the table */
  float area = 0.0f; /*The area of a circle */
  float Pi = 3.1415926f;

  printf("Input the diameter of the table :6");
  scanf("%f",&diameter); /*Read the diameter from the keyboard */
  radius = diameter/2.0f; /*Calculate the radius */
  circumference = 2.0f*Pi*radius; /*Calculate the circumference */
  area = Pi*radius*radius; /*Calculate the area */
  printf("\nThe circumference is %,2f",circumference);
  printf("\nThe area is %.2f\n",area );
  getch();
  return 0;
  }

我在编译器里面输入如上:
书上说的是应该输出的如下:
Input the diameter of the table:6

The circumference is 18.85
The area is 28.27


但是为什么我出来的只是:
Input the diameter of the table:

初学者小弟在此谢谢大家了,求解
搜索更多相关主题的帖子: void keyboard include 
2013-04-11 21:31
y3765258
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:106
专家分:172
注 册:2013-4-9
收藏
得分:5 
printf("\nThe circumference is %,2f",circumference);  这里错了 符号。编译器应该报错的啊。

你这代码抄书的吧,太。。。

有问题一起探讨,一起进步。
2013-04-11 21:55
我国的驾
Rank: 2
等 级:论坛游民
帖 子:17
专家分:10
注 册:2012-11-25
收藏
得分:5 
起码要输出   Input the diameter of the table:6
吧。。。
 

 printf("\nThe circumference is %【,】2f",circumference);那个是什么???
2013-04-11 22:01
peach5460
Rank: 15Rank: 15Rank: 15Rank: 15Rank: 15
来 自:武汉
等 级:贵宾
威 望:30
帖 子:2780
专家分:6060
注 册:2008-1-28
收藏
得分:10 
你起码要输入一个6才会有下面的面积显示吧

我总觉得授人以鱼不如授人以渔...
可是总有些SB叫嚣着:要么给代码给答案,要么滚蛋...
虽然我知道不要跟SB一般见识,但是我真的没修炼到宠辱不惊...
2013-04-12 06:55
冯志强采桑子
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2013-4-11
收藏
得分:0 
回复 3楼 我国的驾
我按照书上的 我也不知道 那个6怎么出来的 而且后面的函数都显示不了 求解
2013-04-14 22:06
冯志强采桑子
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2013-4-11
收藏
得分:0 
回复 楼主 冯志强采桑子
我是对书自学 这个问题真心求解啊
2013-04-14 22:07
快速回复:新手使用win-tc时,遇到一个问题,求解???
数据加载中...
 
   



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

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