1.
#include<iostream>
using namespace std;
const int turn = 12;
int main()
{
int n = 0;
cout << "Enter your level(英寸):______\b\b\b\b\b\b";
cin >> n;
cout << "your level(英尺) is:" << n/turn << endl;
return 0;
}
2.
#include<iostream>
using namespace std;
const int inch = 12;
const int meter = 0.0254;
const int pond = 2.2;
int main()
{
int n = 0;
int m = 0;
int p = 0;
cout << "Enter your level:";
cin >> n;
cout << "英尺" ;
cin >> m;
cout << "英寸";
cout << "Enter your weight:";
cin >> p;
int q = (m * inch) + n;
cout << "your level(英寸) is:" << (m * inch) + n << endl;
cout << "your level(meters) is:" << q * meter << endl;
cout << "your weight is:" << p * pond << endl;
cout << "your BMI is:" << (p * pond)/(q * meter * q * meter) << endl;
return 0;
}
3.
#include<iostream>
using namespace std;
const double min = 60;
const double sec = 60;
int main()
{
int degrees = 0;
int minutes = 0;
int seconds = 0;
cout << "Enter a latitude in degrees, minutes, and seconds:" << endl;
cout << "First, enter the degrees:";
cin >> degrees;
cout << "Next, enter the minutes of arc:";
cin >> minutes;
cout << "Finally, enter the seconds of arc:";
cin >> seconds;
double count = 0;
count = ((seconds / sec + minutes)/min) + degrees;
cout << degrees << " degrees, " << minutes << " minutes, " << seconds << " seconds = " << count << " degrees" << endl;
return 0;
}
4.
#include<iostream>
using namespace std;
const int day = 86400;
const int hour = 3600;
const int min = 60;
int main()
{
int total_seconds = 0;
int seconds = 0;
int hours = 0;
int minutes = 0;
int days = 0;
cout << "Enter the number of seconds:";
cin >> total_seconds;
days = total_seconds/day;
hours = (total_seconds - days * day)/hour;
minutes = (total_seconds - days * day - hours * hour)/min;
seconds = (total_seconds - days * day - hours * hour - minutes * min);
cout << total_seconds << " seconds = " << days
<< " days, " << hours << " hours, " << minutes
<< " minutes, " << seconds << " seconds " << endl;
return 0;
}
5.
#include<iostream>
using namespace std;
int main()
{
long long world = 0;
long long us = 0;
double precent = 0;
cout << "Enter the world's population: ";
cin >> world;
cout << "Enter the population of the US: ";
cin >> us;
precent = us / world;
cout << " The population of the US is " << precent << "% of the world population." << endl;
return 0;
}