Second=seconds%seconds_per_minute;
cout<
int main()
{
using namespace std;
cout<<"Enter the world population:";
long long world_population;
cin>>world_population;
cout<<"Enter the population of the US:";
long long US_population;
cin>>US_population;
double percentage;
percentage=(double)US_population/world_population*100;
cout<<"The population of the US is "<
int main()
{
using namespace std;
cout<<"Enter the miles of distance you have driven:";
double m_distance;
cin>>m_distance;
cout<<"Enter the gallons of gasoline you have used:";
double m_gasoline;
cin>>m_gasoline;
cout<<"Your car can run "<>k_distance;
cout<<"Enter the petrol in liters:";
double k_gasoline;
cin>>k_gasoline;
cout<<"In European style:"<<"your can used "<<100*k_gasoline/k_distance<<"
per 100 kilometers\n";
liters of petrol
return 0;
}
automobile gasoline consumption- 耗油量 --欧洲风格 (L/100Km)转换成美国风格 (mpg)
//ex3.7
#include
int main()
{
using namespace std;
cout<<"Enter the automobile gasoline consumption figure in\n"
<<"European style(liters per 100 kilometers):";
double Euro_style;
cin>>Euro_style;
cout<<"Converts to U.S. style(miles per gallon):"<
int main()
{
using namespace std;
cout<<"Enter the automobile gasoline consumption figure in\n"
<<"U.S. style(miles per gallon):";
double US_style;
cin>>US_style;
cout<<"Converts to European style(miles per gallon):"<//ex4.1 display the information of student
#include
const int Asize=20;
using namespace std;
struct student// 定义结构描述
{
char firstname[Asize];
char lastname[Asize];
char grade;
int age;
};
void display(student);// 函数原型放在结构描述后
int main()
{
cout<<"what is your first name?"<>lcg.grade;
cout<<"what is your age?"<>lcg.age;
display(lcg);
return 0;
}
void display(student name)
{
cout<<"Name: "<
#include
int main()
{
using namespace std;
string name,dessert;
cout<<"Enter your name: \n";
getline(cin,name);