//
// main.cpp
// 2_1
//
// Created by T.P on 2018/2/28.
// Copyright © 2018年 T.P. All rights reserved.
// #include <iostream>
#include <iomanip>
using namespace std; int main() {
cout<<"Hello!"<<endl;
cout<<"Welcome to C++!"<<endl;
cout<<setw(10)<<setprecision(3)<<3.1415<<endl; int score=61;
cout<<(score>=60? "pass":"fail")<<endl
<<endl; return 0;
}

//
// main.cpp
// 2_2
//
// Created by T.P on 2018/3/4.
// Copyright © 2018年 T.P. All rights reserved.
// //判断闰年
//:闰年可以被4整除而不能被100整除,或者能被400整除。 //表达式((year%4==0&&year%100!=0)||(year%400==0)) #include <iostream>
#include <iomanip> //包含IO类库操作符
using namespace std; //没写 using namespace std; 用 std::cout
//写了 using namespace std; 用 cout 就可以了。 int main(int argc, const char * argv[]) {
// insert code here...
//std::cout << "Hello, World!\n";
int year;
bool isLeapYear; cout<<"Enter the year:";
cin>>year;
isLeapYear=((year%4==0&&year%100!=0)||(year%400==0)); if(isLeapYear)
cout<<year<<"is a leap year"<<endl;
else
cout<<year<<" is not a leap year"<<endl; return 0;
}

//
// main.cpp
// 2_3
//
// Created by T.P on 2018/3/4.
// Copyright © 2018年 T.P. All rights reserved.
// //比较两个数的大小
#include <iostream>
#include <iomanip>
using namespace std; int main(int argc, const char * argv[]) {
int x,y;
cout<<"Please Enter x and y : ";
cin>>x>>y;
cout<<endl;
if(x!=y){
if(x>y)
cout << "x>y";
else
cout << "x<y";
}
else
cout << "x=y";
cout << endl;
return 0;
}

//
// main.cpp
// 2_4
//
// Created by T.P on 2018/3/4.
// Copyright © 2018年 T.P. All rights reserved.
// //输入一个0~6的整数,转换成星期输出
#include <iostream>
#include <iomanip>
using namespace std; int main(int argc, const char * argv[]) {
// insert code here...
//std::cout << "Hello, World!\n";
int day;
cin>>day;
switch (day) {
case 0:
cout<<"Sunday";
break;
case 1:
cout<<"Monday";
break;
case 2:
cout<<"Tuesday";
break;
case 3:
cout<<"Wednesday";
break;
case 4:
cout<<"thursday";
break;
case 5:
cout<<"Friday";
break;
case 6:
cout<<"Saturday";
break;
default:
cout<<"Day out of range Sunday...Saturday";
break;
}
cout<<endl;
return 0;
}

最新文章

  1. 使用emIDE创建STM32项目
  2. 游戏服务器ID生成器组件
  3. Lambda表达式关于like问题(未解决)
  4. Django 学习笔记之二 基本命令
  5. SQL语句之二建表
  6. linux应用程序地址布局
  7. Apache Spark2.0正式发布
  8. redis在spring中的配置及java代码实现
  9. iPhone开发技巧之日志保存教程
  10. MySQL5.6新特性Index conditontion pushdow
  11. php基础知识(二)---2017-04-14
  12. Mybatis第九篇【基于Maven在Idea下Mybatis逆向工程】
  13. 关于在 IntellIj IDEA中JSP页面 cannot resolve method getParameter(&quot;&quot;)的解决方案
  14. 大白话Vue源码系列(01):万事开头难
  15. MySQL数据转移至SQL Server详解
  16. java数组-如何在一堆数据中使用数组!
  17. zookkeper原理学习
  18. git 版本库拆分和subtree用法
  19. 生成Markdown目录 字符串解析 MD
  20. Unity3D Shader基础教程

热门文章

  1. 从DataTable中删除不被控件支持的字段类型
  2. thinkphp 本地配置手机移动端,在pc端访问手机端
  3. hdu 2986 Ballot evaluation (Simulation)
  4. H3C 会话层、表示层和应用层
  5. JS 动态表格
  6. Adam那么棒,为什么还对SGD念念不忘 (2)—— Adam的两宗罪
  7. BZOJ 4034&quot;树上操作&quot;(DFS序+线段树)
  8. vue——父子传值
  9. Python--day45--pymysql模块初识以及SQL注入
  10. element-UI table分页之后保存已经勾选的标签