What could be simpler than assigning a value to two constants and printing them out? Yet in something so simple there is a problem. Why is one of the zip codes wrong?
1 /************************************************
2 * print_zip -- Print out a couple of zip codes.*
3 ************************************************/
4 #include <iostream>
5 #include <iomanip>
6
7 int main()
8 {
9 // Zip code for San Diego
10 const long int san_diego_zip = 92126;
11
12 // Zip code for Boston
13 const long int boston_zip = 02126;
14
15 std::cout << "San Diego " << std::setw(5) <<
16 std::setfill('0') <<
17 san_diego_zip << std::endl;
18
19 std::cout << "Boston " << std::setw(5) <<
20 std::setfill('0') <<
21 boston_zip << std::endl;
22
23 return (0);
24 }