dimanche 7 mars 2021

Write in a program inside a if statement (C++)

Hi I am trying to make Height Energy Calculator but after the if statement It is just close the program.

This is the Code:

#include <iostream>
#include <string>
#include <vector>

int main()
{
    bool Ph = true;
    std::cout << "Height True Or False: \n";
    std::cin >> Ph;
    double M = 0;
    double G = 0;
    double H = 0;
    
    
    if (Ph == true)
    {
        std::cout << "Mass:\n";
        std::cin >> M;
        std::cout << "Gravity:\n";
        std::cin >> G;
        std::cout << "Height:\n";
        std::cin >> H;
    }

    
}

double PhyH(double M, double G, double H)
{
    return (M * G) * H;
}

Thanks for the helpers.

Aucun commentaire:

Enregistrer un commentaire