最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

C++ Primer Plus學習代碼

2023-02-14 23:48 作者:夕陽棲落  | 我要投稿

#include <iostream>

#include <climits>

#include <stdio.h>


int main() {

using namespace std;

//--------章節(jié)筆記--------

/*

int n_int = INT_MAX;

short n_short = SHRT_MAX;

long n_long = LONG_MAX;

long long n_llong = LLONG_MAX;

cout << "int is " << sizeof (int) << " bytes." << endl;

cout << "short is " << sizeof n_short << " bytes." << endl ;

cout << "long is " << sizeof n_long << " bytes." << endl;?

cout << "long long is " << sizeof n_llong << " bytes." << endl;

cout << "Minimum int value = " << INT_MAX << endl;

cout << "Bits oer byte = " << CHAR_BIT << endl;

int chest = 42;

int waist = 0x42;

int inseam = 042;

cout << "Monsieur cuts a striking figure!" << endl;

cout << "chest = " << chest << "(42 in decimal)" << endl;

cout << hex;

cout << "waist = " << chest << " (0x42 in hex)" << endl;

cout << oct;

cout << "inseam = " << chest << " (42 in octal)" << endl;

cout << "a\vb\ac\r\r";

int k\u00F6rper;

cout << "\aOperation \"HyperHype\" is now activated!\n";

cout << "Enter yuor agent code:________\b\b\b\b\b\b\b\b";

long code;

cin >> code;

cout << "\aYou enterd " << code << "...\n";

cout << "\aCode verified! Proceed with Plan z3!\n";

cout.setf(ios_base::fixed, ios_base::floatfield);//fixed-point

float tub = 10.0 / 3.0; // good to about 6 places

double mint = 10.0 / 3.0; // good to about 15 places

const float million = 1.0e6;

cout << "tub = " << tub;

cout << ", a million tubs = " << million * tub;

cout << ",\nand ten million tubs = ";

cout << 10 * million * tub << endl;

cout << "mint = " << mint << " and a million mints = ";

cout << million * mint << endl;

cout << 120 / 4 * 5 << endl;

const int Lbs_per_stn = 14;

int lbs;

cout << "Enter your weiht in pounds: ";

cin >> lbs;

int stone = lbs / Lbs_per_stn;

int pounds = lbs % Lbs_per_stn;

cout << lbs << " pounds are " << stone << " stone, " << pounds << " pound(s).\n"*/

//--------3.7 習題1

/*int height_inch, height_foot;

const int FOOT_TO_INCH = 12; //foot=12inch

cout << "Enter your height in inchs:___\b\b\b";

cin >> height_inch;

height_foot = FOOT_TO_INCH * height_inch;

cout << "\nYour height have " << height_inch << " inch, or " << height_foot << " foot." << endl;

//--------3.7 習題2

const int FOOT_TO_INCH = 12;

const float INCH_TO_METER = 0.0254;

const float KG_TO_POUNDS = 2.2;

int height_foot;

float height_inch, weight_pounds;

float height_meter, BMI, weight_kg;

cout << "Enter your height foot and inch:__________\b\b\b\b\b\b\b\b\b";

cin >> height_foot >> height_inch;

cout << "And your weight ponds:________\b\b\b\b\b\b\b";

cin >> weight_pounds;

height_meter =( (height_foot * FOOT_TO_INCH) + height_inch) * INCH_TO_METER;

weight_kg = weight_pounds * KG_TO_POUNDS;

BMI = weight_kg / (height_meter * height_meter);

cout << "Your height have " << height_meter << " METER, and your weight have " << weight_kg << " KG.\n";

cout << "Your BMI is " << BMI << endl;*/

//--------3.7 習題2

/*const int DEGREES_TO_MINUTES = 60, MINUTES_TO_SECONDS = 60;

float degrees, minutes, seconds;

float degrees_style;

cout << "Enter a latitude in degrees, mintues, seconds:\n";

cout << "First, enter the degrees:_____\b\b\b\b";

cin >> degrees;

cout << "Next, enter the mintues of arc:_____\b\b\b\b";

cin >> minutes;

cout << "Finallt, enter the seconds of arc:_____\b\b\b\b";

cin >> seconds;

degrees_style = (((seconds / MINUTES_TO_SECONDS) + minutes) / DEGREES_TO_MINUTES) + degrees;

cout << degrees << " degrees, " << minutes << " minutes, " << seconds << " seconds = " << degrees_style << " degrees.\n";*/

//--------3.7 習題4

/*const int DAYS_TO_HOURS = 24;

const int HOURS_TO_MINUTES = 60;

const int MINUTES_TO_SECONDS = 60;

long seconds = 0;

long long minutes = 0, hours = 0, days = 0, sec = 0;

cout << "Enter the number of seconds: ";

cin >> seconds;

days = seconds / (DAYS_TO_HOURS * HOURS_TO_MINUTES * MINUTES_TO_SECONDS);

hours = seconds / (HOURS_TO_MINUTES * MINUTES_TO_SECONDS) - days * DAYS_TO_HOURS;

minutes = seconds / MINUTES_TO_SECONDS - days * DAYS_TO_HOURS * HOURS_TO_MINUTES - hours * HOURS_TO_MINUTES;

sec = seconds - (days * DAYS_TO_HOURS * HOURS_TO_MINUTES + hours * HOURS_TO_MINUTES + minutes) * MINUTES_TO_SECONDS;

cout << "\n" << seconds << " seconds = ";

cout << days << " days, " << hours << " hours, " << minutes << "minutes, " << sec << "seconds.\n";*/

//--------3.7 習題5

/*long long population_world = 0, population_us = 0;

cout << "Enter the world's population: ";

cin >> population_world;

cout << "Enter the population of the US: ";

cin >> population_us;

cout << "The population of the US is "?

<< long double(population_us) / long double(population_world) * 100

<< "% of the world population.";*/

//--------3.7 習題6

/*int choose = 0;

float distaance = 0, fuel = 0;

cout << "Please choose unit:\n1. miles and gallon\n2. kilometer and liter\n";

cin >> choose;

if (choose == 1){

cout << "Enter the distance in miles: ";

cin >> distaance;

cout << "Enter the fuel consume in gallon: ";

cin >> fuel;

cout << "The fuel consume is " << distaance / fuel << " mpg(miles/gllon).";

}

else if (choose == 2) {

cout << "Enter the distance in kilometer: ";

cin >> distaance;

cout << "Enter the fuel consume in liter: ";

cin >> fuel;

cout << "The fuel consume is " << distaance / fuel << " L/100KM." << endl;

}

else

{

cout << "Input error!!!" << endl;

}*/

//--------3.7 習題7

/*const float KM_TO_MILE = 62.14;

const float GALLON_TO_L = 3.785;


float fuel_consume_eur = 0, fuel_consume_us = 0;

cout << "Enter the fuel consume in europe(L/100KM): ";

cin >> fuel_consume_eur;

fuel_consume_us = KM_TO_MILE / ( fuel_consume_eur / GALLON_TO_L );

cout << "The fuel consume is " << fuel_consume_eur << " L/100KM.\n";

cout << "The fuel consume is " << fuel_consume_us << " mpg.\n";*/


cin.get();?

return 0;



}


C++ Primer Plus學習代碼的評論 (共 條)

分享到微博請遵守國家法律
连南| 松江区| 富平县| 阿拉善盟| 永顺县| 宜春市| 石城县| 沅陵县| 灵璧县| 锡林浩特市| 湟中县| 大厂| 汉源县| 凤阳县| 昌吉市| 庆元县| 宜宾市| 耿马| 五台县| 惠东县| 开封县| 新竹市| 霍林郭勒市| 日照市| 石屏县| 苗栗县| 定南县| 高雄市| 恭城| 建德市| 泰兴市| 响水县| 肃宁县| 务川| 休宁县| 鲁甸县| 合江县| 天津市| 叶城县| 卢湾区| 永靖县|