#include<iostream>usingnamespace std;intmain(){//1英尺 = 12英寸constdouble factor_inch =12;constdouble factor_m =0.0254;constdouble factor_kg =2.2;double inch;double feet;double weight;double m;double BMI;double kg;
cout<<"请以几英尺几英寸的方式输入身高"<<endl;
cout<<"英尺:";
cin>>feet;
cout<<"英寸:";
cin>>inch;
cout<<"请以磅为单位输入体重:";
cin>>weight;
inch = factor_inch * feet;
m = inch * factor_m;
kg = weight / factor_kg;
BMI = kg /(m*m);
cout<<"你的BMI是:"<<BMI;system("pause");return0;}
#include<iostream>usingnamespace std;intmain(){int degree =0;int minutes =0;int seconds =0;double total;
cout <<"Enter a latitude in degrees,minutes,and secondes:"<<endl;
cout <<"First,enter the degree:";
cin >> degree;
cout <<"Next,enter the minutes of arc:";
cin >> minutes;
cout <<"Finally,enter the seconds of arc:";
cin >> seconds;
total = degree + minutes /60.0+ seconds /3600.0;
cout << degree <<" degree, "<< minutes <<" minutes, "<< seconds <<" seconds = "<< total <<" degrees";system("pause");return0;}
#include<iostream>usingnamespace std;intmain(){long sec;int day;int hours;int min;
cout <<"Enter the number of seconds:";
cin >> sec;
day = sec /(60*60*24);
hours =(sec - day *(60*60*24))/(60*60);
min =(sec -(day *(60*60*24)+ hours *(60*60)))/60;int num = sec - day *3600*24- hours *3600- min *60;
cout << sec <<" seconds = "<< day <<" days, "<< hours <<" hours "<< min <<" minutes, "<< num <<" seconds";system("pause");return0;}
#include<iostream>usingnamespace std;intmain(){longlong world_pop;longlong us_pop;
cout <<"Enter the world's population:";
cin >> world_pop;
cout <<"Enter the population of the us:";
cin >> us_pop;//6898758899//310783781
cout <<"The population of the US is "<<double(us_pop)/double(world_pop)*100<<"% of the world population.";system("pause");return0;}