Monday, January 25, 2010

Program 6: Gotta Have My Space













Program 6: Gotta Have My Space

Here's a short experiential program written by someone the first week he was learning how to program. It's designed to print an simple answer. But things don't quite go right.




1 /************************************************
2 * Double a number. *
3 ************************************************/
4 #include <iostream>
5
6 int main(void)
7 {
8 int number; // A number to double
9
10 std::cout << "Enter a number:";
11 std::cin >> number;
12
13 std::cout << "Twice" << number << "is" <<
14 (number * 2) << '\n';
15 return (0);
16 }


(Next Hint 247. Answer 23.)




















No comments: