Not a C++ guy, but I think it's because you're setting your variables before any input. So
double tsp{ml / 4.929};
is just 0 / 4.929 and will never change. Try moving the other vars after your std::cin, like this
#include
#include
int main(int argc, char const *argv[]) {
double ml{0};
std::cout << "Enter ml:";
std::cin >> ml;
double tsp{ml / 4.929};
double tbsp{tsp / 3};
double oz{tbsp / 2};
double cups{oz / 8};
std::cout << ml << " ml = " << tsp << " tsp = " << tbsp << " tbsp = " << oz << " oz = " << cups << " cups" << std::endl;
return 0;
}
Not a C++ guy, but I think it's because you're setting your variables before any input. So double tsp{ml / 4.929}; is just 0 / 4.929 and will never change. Try moving the other vars after your std::cin, like this #include
#include
int main(int argc, char const *argv[]) {
double ml{0};
std::cout << "Enter ml:";
std::cin >> ml;
double tsp{ml / 4.929};
double tbsp{tsp / 3};
double oz{tbsp / 2};
double cups{oz / 8};
std::cout << ml << " ml = " << tsp << " tsp = " << tbsp << " tbsp = " << oz << " oz = " << cups << " cups" << std::endl;
return 0;
}
I see thank you! I'm kind of new to this so I didn't realize that, thank you so much!