#include <iostream> using namespace std; int main() { float num1 = 1.1; double num2 = 1.1; if (num1 == num2) cout << "stanford"; else cout << "harvard"; return 0; }
a) harvard
b) stanford
c) compile time error
d) runtime error
#include <iostream> using namespace std; int main() { float num1 = 1.1; double num2 = 1.1; if (num1 == num2) cout << "stanford"; else cout << "harvard"; return 0; }
a) harvard
b) stanford
c) compile time error
d) runtime error
You must be logged in to post a comment.
a
Explanation: Float store floating point numbers with 8 place accuracy and requires 4 bytes of Memory. Double has 16 place accuracy having the size of 8 bytes.
Output:
$ g++ float3.cpp
$ a.out
harvard