Every C++ program must contain a ____ function.

One comment

  • Diego Torres says:

    Hello Matthew,
    Here’s a question found on myprogramming lab for C++:
    Given an integer variable i and a floating-point variable f, write a statement that writes both of their values to standard output in the following format: i=value -of-i f=value -of-f

    Thus, if i has the value 25 and f has the value 12.34, the output would be:
    i=25 f=12.34
    But if i has the value 187 and f has the value 24.06, the output would be:
    i=187 f=24.06

    Here’s my code:
    #include
    #include
    using namespace std;
    int main()
    {
    int i;
    float f;
    i = 25;
    f = 12.34;
    cout << "i=" << i <<"\n";
    cout << "f=" << f;
    return 0;
    }

    And for some reason the my answer is wrong. Is there something I missed? Thanks

Add comment