摘要: 变量可以通过有别的变量参与的计算来初始化。 1 using namespace std; 2 #include <iostream> 3 4 int main () 5 { 6 double a = 12 * 3.25; 7 double b = a + 1.112; 8 9 cout << "a contains: " << a << endl;10 cout << "b contains: " << b << endl;11 12 a = a * 2 + b;13 1 阅读全文
posted @ 2012-08-25 10:28 beforus 阅读(86) 评论(0) 推荐(0) 编辑
摘要: 变量可以在代码中的任意位置声明。 1 using namespace std; 2 #include <iostream> 3 4 int main () 5 { 6 double a; 7 8 cout << "Hello, this is a test program." << endl; 9 10 cout << "Type parameter a: ";11 cin >> a;12 ... 阅读全文
posted @ 2012-08-25 10:24 beforus 阅读(141) 评论(0) 推荐(0) 编辑