Thursday, October 11, 2012

Test Puzzle #2

Today another code review, please test this C++ code:
Difficulty: 1/4


#include <iostream>
 
using namespace std;
 
int annualSalary(float monthSalary)
{
        return monthSalary * 12.0;
}
 
int main() 
{
        cout << annualSalary(2124.47) << endl;
        return 0;
}

Answer:  wrong variable type was returned. See also this code on Ideone.

No comments:

Post a Comment