赞
踩
- #include <iostream>
- using namespace std;
- int main() {
- int myAge = 39;
- int yourAge = 39;
- cout << "I am: " << myAge << "years old." << endl;
- cout << "you are :" << yourAge << "years old." << endl;
- myAge++;
- ++yourAge;
- cout << "one year passes..." << endl;
- cout << "I am: " << myAge << "years old." << endl;
- cout << "you are :" << yourAge << "years old." << endl;
- cout << "another year passes..." << endl;
- cout << "I am: " << myAge++ << "years old." << endl; //这里自加++后置,所以myAge先随cout输出再自加1;
- cout << "you are :" << ++yourAge << "years old." << endl;
- cout << "Let's print it again." << endl;
- cout << "I am: " << myAge << "years old." << endl;
- cout << "you are :" << yourAge << "years old." << endl;
- return 0;
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。