solution7 - interpreted as an integer number or a real...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CSCI-1100 Computer Science I Rensselaer Polytechnic Institute Spring 2004 Studio 7 -- Solutions 1. a) 00000000 00000000 00000000 00001010 b) 11111111 11111111 11111111 11110110 c) 11111111 11111111 11111111 11111111 d) 11111111 11111111 11111111 11111110 e) 00000000 00000000 00000000 00000000 2. a) 00001000 10000000 00000000 00000000 b) 00000101 10111010 00000000 00000000 3. Just looking at the string of bits, the computer has no way to determine whether it represents an integer or a real number, it could be either. Thus, when we write programs for computers, we must always tell the computer whether a number is to be
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: interpreted as an integer number or a real number. This is why variables have types (e.g., int, long, float, double). 4. // Display the maximum of three integers #include <iostream> using namespace std; void max3(int a, int b, int c) { if ((a >= b) && (a >= c)) { cout << "The largest number is " << a << endl; } if ((b > a) && (b >= c)) { cout << "The largest number is " << b << endl; } if ((c > a) && (c > b)) { cout << "The largest number is " << c << endl; } } int main() { int a, b, c; cout << "Enter three integers: "; cin >> a >> b >> c; max3(a, b, c); return 0; }...
View Full Document

This homework help was uploaded on 04/16/2008 for the course CSCI 1100 taught by Professor Hardwick during the Fall '08 term at Rensselaer Polytechnic Institute.

Page1 / 2

solution7 - interpreted as an integer number or a real...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online