#include <iostream> using namespace std; //practice 1 void main() { ?? ?cout << "lemon" << endl; ?? ?cout << "Henan,China" << endl; } //pracitce 2 int main() { ?? ?int a, b; ?? ?cout << "请输入一个以long为单位的距离:" << endl; ?? ?cin >> a; ?? ?b = a * 220; ?? ?cout << "其等于" << b << "码" << endl; } //pracitce 3 void ?mice(); void how(); void main() { ?? ?mice(); ?? ?mice(); ?? ?how(); ?? ?how(); ?? ?return; } void mice() { ?? ?cout << "Three blind mice" << endl; ?? ?return; } void how() { ?? ?cout << "See how they run" << endl; ?? ?return; } //pracitce 4 void month(int); void main() { ?? ?int a; ?? ?cout << "请输入年龄:" << endl; ?? ?cin >> a; ?? ?month(a); ?? ?return; } void month(int n) { ?? ?int b; ?? ?b = n * 12; ?? ?cout << "该年龄包含" << b << "个月"; ?? ?return; } //practice 5 void Fahr(double); void main() { ?? ?double a; ?? ?cout << "Please enter a Cesius value:"; ?? ?cin >> a; ?? ?Fahr(a); ?? ?return; } void Fahr(double n) { ?? ?double b; ?? ?b = 1.8 * n + 32.0; ?? ?cout << "20 degrees Celsius is " << b << " degrees Fahrenheit."; ?? ?return; } //practice 6 double astr(double); void ?main() { ?? ?double a, c; ?? ?cout << "Enter the number of light years:"; ?? ?cin >> a; ?? ?cout << a << " light years = " << astr(a) << " astronomical units."; ?? ?return; } double astr(double n) { ?? ?double b; ?? ?b = 63240 * n; ?? ?return b; } //practice 7 void time(int, int); void main() { ?? ?int a, b; ?? ?cout << "Enter the number of hours: "; ?? ??? ?cin >> a; ?? ??? ?cout << "Enter the number of minutes: "; ?? ?cin >> b ; ?? ?time(a, b); ?? ?return; } void time(int m, int n) { ?? ?cout << "Time: " << m << ":" << n; ?? ?return; }
|