1、
#include<iostream> using namespace std; int main() { cout << "Name: Luoxiao,\nAddress: Xidian University, Xi'an, Shaanxi Province, China.\n"; return 0; }
2、
#include<iostream> using namespace std; int main() { float longs; cout << "Please input the distance in longs: "; cin >> longs; cout << longs << " longs equals to " << 220 * longs << " yards.\n"; return 0; }
3、
#include<iostream> using namespace std; void fun1(void); void fun2(); int main() { fun1(); fun1(); fun2(); fun2(); return 0; } void fun1() { cout << "Three blind mice\n"; } void fun2() { cout << "See how they run\n"; }
4、
#include<iostream> using namespace std; int main() { int age; cout << "Enter your age: "; cin >> age; cout << "Age " << age << " includes " << 12 * age << " months.\n"; return 0; }
5、
#include<iostream> using namespace std; int main() { float celsius; cout << "Please enter a Celsius value: "; cin >> celsius; cout << celsius << " degrees Celsius is " << 1.8 * celsius + 32.0 << " degrees Fahrenheit.\n"; return 0; }
6、
#include<iostream> using namespace std; int main() { double lightYears; cout << "Enter the number of light years: "; cin >> lightYears; cout << lightYears << " light years = " << 64240 * lightYears << " astronomial units.\n"; return 0; }
7、
#include<iostream> using namespace std; void fun(int, int); int main() { int hour, minute; cout << "Enter the number of hours: "; cin >> hour; cout << "Enter the number of minutes: "; cin >> minute; fun(hour, minute); return 0; } void fun(int hour, int minute) { cout << hour << ":" << minute << endl; }
标签:std,PrimerPlus,cout,int,namespace,C++,第六版,using,main From: https://www.cnblogs.com/xinmind/p/16861787.html