码迷,mamicode.com
首页 > 其他好文 > 详细

talkback.c

时间:2014-10-27 14:01:31      阅读:314      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   io   color   ar   for   sp   div   

  我的疑惑在于“质量和重量”。以前学的物理数学都忘的差不多咯。

  看到网友是这么说的,所以我就来搬运了:

    平时说的重量,在质量中叫质量,用m 表示,体积用V表示,密度用ρ表示
    当知体积和密度时,可用下面的公式计算
      m=ρV
    即:质量=密度 X 体积

  看到这里就有点理解书中计算啦!

  又看看别的:

    重量=体积*密度*g (g为重力加速度不是克 ,一般为9.8)
    质量=体积*密度

  我只想说以前上学学的东西还是很经典的,可惜的是如果不是学c,我估计不会捡起来啦!

 

 

 C++ Code 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
 
#include <stdio.h>
#include <string.h>
#include <windows.h>
#define DENSITY 62.4

// density--密度
// volume--体积、容量
// letters--字母(个数)
// cubic feet--立方
int main(void)
{
    
float weight, volume;
    
int size, letters;
    
char name[40];

    printf(
"Hi! What‘s your first name? \n");
    scanf(
"%s", name);
    printf(
"%s, what‘s your weight in pounds? \n", name);
    scanf(
"%f", &weight);

    size = 
sizeof name;
    letters = strlen(name);
    volume = weight / DENSITY; 
// 核心问题是你不知到计算公式!

    printf(
"Well, %s, your volume is %2.2f cubic feet. \n", name, volume);
    printf(
"Also, your first name has %d letters, ", letters);
    printf(
"and we have %d bytes to store it in. \n", size);

    
//Sleep(1000 * 10); //还有其他的类似的函数么?
    return 0;
}

talkback.c

标签:style   blog   http   io   color   ar   for   sp   div   

原文地址:http://www.cnblogs.com/leefun/p/4053893.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!