1
// ConsoleApplication1.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include<iostream>
using namespace std;
const int factor = 12;
int main()
{
int tall;
cout<<"Haw tall are you : ";
cin >> tall;
cout << "your tall is " << tall / factor << " foot and " << tall % factor << " inch." << endl;
return 0;
}
2
// ConsoleApplication1.cpp : 定义控制台应用程序的入口点。
//
//#include "stdafx.h"
#include<iostream>
//#include<cmath>
using namespace std;
const int factor = 12;
const float vins = 2.2;
const float moon = 0.0254;
int main()
{
int foot,inch,pound;
cout << "Haw tall are you : ";
cout << " foot and inch " << endl;
cin >> foot;
cin >> inch;
cout << "How many yur weight : ";
cin >> pound;
cout << "your tall is " << foot*factor+inch << " inch or your tall is " << moon*(foot*factor+inch) << " meter." << endl;
cout << "your weight is " << pound / vins << " kg" << endl;
cout << "your BMI is " << (pound / vins) / pow(moon*(foot*factor + inch), 2) << endl;
return 0;
}
3
// ConsoleApplication1.cpp : 定义控制台应用程序的入口点。
//
//#include "stdafx.h"
#include<iostream>
//#include<cmath>
using namespace std;
const int factor = 60;
int main()
{
float d,m,s;
cout << "Enter a latitude in degreees,minutes,seconds : " << endl;
cout << "First,enter the degrees : ";
cin >> d;
cout << "Next,enter the minutes of arc : ";
cin >> m;
cout << "Finally,enter the seconds of arc : ";
cin >> s;
cout << d << " degrees," << m << " minutes," << s << " seconds = " << d + (m + s / 60) / 60 << " degrees";
return 0;
}
4
// ConsoleApplication1.cpp : 定义控制台应用程序的入口点。
//
//#include "stdafx.h"
#include<iostream>
//#include<cmath>
using namespace std;
const int d_factor =24*60*60;
const int h_factor = 60 * 60;
const int m_factor = 60;
int main()
{
long long s;
cout << "Enter the number of seconds : ";
cin >> s;
cout << s << " seconds = " << s / d_factor << " days, " << (s%d_factor) / h_factor << " hours, " << ((s%d_factor) % h_factor) / m_factor << " minutes, " << ((s%d_factor) % h_factor) % m_factor << " seconds" << endl;
return 0;
}
5
// ConsoleApplication1.cpp : 定义控制台应用程序的入口点。
//
//#include "stdafx.h"
#include<iostream>
//#include<cmath>
using namespace std;
int main()
{
long long p_w, p_a;
cout << "Enter the world's population : ";
cin >> p_w;
cout << "Enter the population of the US : ";
cin >> p_a;
cout << "The population of the US is " << p_a*100.0/p_w << "% of the world population.";
return 0;
}
6
// ConsoleApplication1.cpp : 定义控制台应用程序的入口点。
//
//#include "stdafx.h"
#include<iostream>
//#include<cmath>
using namespace std;
int main()
{
float km, l;
cout << "输入公里数 : ";
cin >> km;
cout << "输入耗油量(升) : ";
cin >> l;
cout << "百公里耗油量为:" << l*100/ km;
return 0;
}
7
// ConsoleApplication1.cpp : 定义控制台应用程序的入口点。
//
//#include "stdafx.h"
#include<iostream>
//#include<cmath>
using namespace std;
int main()
{
float l;
cout << "输入每100公里消耗的汽油量(升) : ";
cin >> l;
cout <<1.0/( l / (3.875*62.14)) << " mpg";
return 0;
}