Answers for "decising how many numbers after comma c++"

C++
0

decising how many numbers after comma c++

#include <iostream>
#include <iomanip>

int main(int argc, char** argv)
{
    float testme[] = { 0.12345, 1.2345, 12.345, 123.45, 1234.5, 12345 };

    std::cout << std::setprecision(2) << std::fixed;

    for(int i = 0; i < 6; ++i)
    {
        std::cout << testme[i] << std::endl;
    }

    return 0;
}
Posted by: Guest on July-29-2021

Code answers related to "decising how many numbers after comma c++"

Browse Popular Code Answers by Language