如何根据用户的增量输出此代码以输出更改的质量值?

时间:2017-12-24 02:31:39

标签: visual-c++

程序输出质量,但仅输出用户输入的数量。那个数学  应该添加质量的增量没有发生。有人可以帮忙吗?  此?

#include <conio.h>
#include <stdio.h>
#include <Windows.h>
#include <time.h>
#include <math.h>
#define _CRT_SECURE_NO_WARNINGS
int main()
{
    float mass;
    float acceleration;
    float force;
    int calc1;
    int calc2;
    int calc3;
    float mass2;
    float increment;
    printf("Insert acelleration and mass below to calculate \nforce of a 
    given obect's movement.\n");
    printf("Mass (kg):\n");
    scanf("%f", &mass);
    printf("Acceleration (m/s/s):\n");
    scanf("%f", &acceleration);
    printf("Input Mass increment:\n");
    scanf("%i", &increment);
    calc2 = 1;
    mass2 = mass + increment;
    force = mass * acceleration;
    do
    {
        printf("%f(Kg)\t%f(M/s^2)\t%f(Newtons)\n", mass2, acceleration, 
        force);
        calc2++;
    } while (calc2 <= calc1);
    getch();
    return 0;
}

0 个答案:

没有答案