CPP_Basic_Code_P2.1-PP2.7.7

CPP_Basic_Code_P2.1-PP2.7.7

//  The Notes Created by Z-Tech on 2017/2/17.
//  All Codes Boot on 《C++ Primer Plus》V6.0
//  OS:MacOS 10.12.4
//  Translater:clang/llvm8.0.0 &g++4.2.1
//  Editer:iTerm 2&Sublime text 3
//  IDE: Xcode8.2.1&Clion2017.1

//P2.1
#include //Hello,C++
int main()
{
    using namespace std;
    cout <<"Come up and C++ me some time.";
    cout <
int main()
{
    using namespace std;
    int carrots;
    carrots=25;
    cout<<"I Have ";
    cout<
int main()
{
    using namespace std;
    int carrots;
    cout<<"How many Carrots do you have?"<>carrots;
    cout<<"Here are two more. ";
    carrots=carrots+2;
    cout<<"Now you have "<
#include //是C中math.h的升级
int main()
{
    using namespace std;
    double area;
    cout<<"Enter the floor area,in square feet,of your home:";
    cin>>area;
    double side=sqrt(area);//开方计算
    cout<<"That's the equvalent of a square  "<
void simon(int)//函数声明
int main()
{
    using namespace std;
    simon(3);
    cout<<"Pick an integer: ";
    int count;
    cin>>count;
    simon(count);
    cout<<"Done"<
int stonetolb(int);
int main()
{
    using namespace std;
    int stone;
    cout<<"Enter the weight in stone:";
    cin>>stone;
    int pounds=stonetolb(stone);
    cout<
int main()
{
    using  namespace std;
    cout<<"Please input a distance:";
    double xLong;
    cin>>xLong;
    double  Ma=220*xLong;
    cout<
void z_tech1();
void z_tech2();
int main()
{
    using namespace std;
    z_tech1();//无参数无返回值
    z_tech1();
    z_tech2();
    z_tech2();
    return 0;
}
void z_tech1()
{
    using namespace std;
    cout<<"Three blind mice "<
int main()
{
    using namespace std;
    cout<<"Please enter your age(years):"<>Year;
    cout<
double Fahrenheit(double);
int main()
{
    using namespace std;
    cout<<"Please enter a celsius value: "<>Celsius;
    cout<
double astronomical_units(double);
int main()
{
    using namespace std;
    cout<<"Please enter the number of light year: "<>Lightyear;
    double astr_units=astronomical_units(Lightyear);
    cout<
void time(int,int);//多参数申明
int main()
{
    using namespace std;
    cout<<"Please enter the number of hours: ";
    int hours;
    cin>>hours;
    cout<<"Please enter the number of minutes: ";
    int minutes;
    cin>>minutes;
    time(hours,minutes);
    return 0;
}
void time(int a,int b)//多参数函数实体
{
    using namespace std;
    cout<<"Time: "<

你可能感兴趣的:(CPP_Basic_Code_P2.1-PP2.7.7)