自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Eroslol的博客

编程新手学习笔记

  • 博客(280)
  • 收藏
  • 关注

原创 使用DatePicker以及TimePicker显示当前日期和时间

package com.example.datetimepicker;import java.util.Calendar;import android.app.Activity;import android.app.DatePickerDialog;import android.app.DatePickerDialog.OnDateSetListener;import androi

2016-11-14 11:13:11 2180

原创 Android 计算器

package com.imooc.calculator;import android.R.bool;import android.R.string;import android.app.Activity;import android.os.Bundle;import android.view.View;import android.view.View.OnClickListener

2016-11-12 18:20:02 555

原创 使用Intent实现页面跳转 (另一种方法)

package com.example.demo1;import android.app.Activity;import android.content.Context;import android.content.Intent;import android.os.Bundle;import android.view.View;import android.view.View.OnC

2016-11-11 16:14:15 2384

原创 使用Intent实现页面跳转

package com.example.demo1;import android.app.Activity;import android.content.Context;import android.content.Intent;import android.os.Bundle;import android.view.View;import android.view.View.OnC

2016-11-11 13:48:53 712

原创 五布局之表格布局TableLayout

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:stretchColumns="*"> <TextView

2016-11-10 09:00:32 483

原创 五布局之帧布局FrameLayout

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <ProgressBar android:layout_grav

2016-11-09 20:26:31 461

原创 五布局之相对布局RelativeLayout

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <ImageView android:id="@+id/i

2016-11-09 19:40:19 452

原创 使用RadioGroup与RadioButton实现单选效果

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" > <RadioG

2016-11-09 14:23:04 3257

原创 使用CheckBox实现多选效果

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" > <CheckB

2016-11-09 13:43:54 1548

原创 ToggleButton按钮实现开关效果

package com.demo2.demo2;import android.app.Activity;import android.os.Bundle;import android.widget.CompoundButton;import android.widget.CompoundButton.OnCheckedChangeListener;import android.widg

2016-11-09 10:49:04 1842

原创 Android笔记

1.wrap_content:包裹实际文本内容match_parent:当前控件铺满父类容器,2.3api之后添加的一个属性值(一般用这个)fill_parent:当前控件铺满父类容器,2.3api之前的一个属性值2.Button和ImageButton:(1)共有的特性:都可以作为一个按钮产生点击事件;(2)不同点:  1>Button有text的属性,Ima

2016-11-09 10:47:13 361

原创 等腰三角形的面积

#include #include #include #includeusing namespace std;/*完善此函数*/double calArea(double a, double b, double c) { if (a <= 0 || b <= 0 || c <= 0) throw invalid_argument("The input is illegal"

2016-10-19 11:34:42 716

原创 重载流运算符

#include #include #include #include using namespace std;class Student{public: int id; string name, grade; Student(){}; Student(int id, string name, string grade); friend istream & operato

2016-10-18 20:15:22 418

原创 浮点数输出

#include #include #include #include using namespace std;int main(void){ int m, n; double num; while (cin >> m >> n >> num) { if (m == 0 && n == 0) cout << 0 << endl; else { cou

2016-10-18 20:01:53 789

原创 字符串出现个数

#include #include#include#includeusing namespace std;int main(){ vector v; string s1, s2; cin >> s1 >> s2; size_t l2 = s2.size(); for (int i = 0; i != s1.size() - l2; i = i + 1) v.push_b

2016-10-17 19:31:47 390

原创 数组排序

#include #include#includeusing namespace std;int main(){ vector v; int n,m; cin >> n; while (n--&&cin >> m) { v.push_back(m); } sort(v.begin(), v.end()); auto end_unique = unique(v.beg

2016-10-17 19:20:10 363

原创 单词计数

#include #include#includeusing namespace std;int main(){ map word_count; string word; while (cin >> word) { if (word == "QUIT") break; else cout << word_count[word]++ << endl; }

2016-10-17 19:14:22 440

原创 数组求和

#include using namespace std;/*请在这里填充代码*/template T getSum(T *ptr,int n){ T sum = 0; while (n != 0) { sum += *ptr++; n--; } return sum;}int main(){ int n, m; cin >> n >> m; int*

2016-10-16 16:48:01 437

原创 C8-2 圆的周长和面积

#include using namespace std;const double pi = 3.14;class Shape{public: Shape(){} ~Shape(){} virtual double getArea() = 0; virtual double getPerim() = 0;};class Circle : public Shape{pub

2016-10-13 13:09:05 553

原创 C8-1 复数加减乘除

#include #include #include #include using namespace std;class Complex{public: Complex(double r = 0.0, double i = 0.0) : real(r), imag(i) {}; Complex operator+ (const Complex &c2) const; Comp

2016-10-13 09:13:31 569

原创 C7-3 用类实现a+b

#include using namespace std;struct Base1{ int x; Base1(int x);};struct Base2{ int x; Base2(int x);};struct Derived :public Base1, public Base2{ int x; Derived(Base1& a, Base2& b);}

2016-10-12 11:07:53 1300

原创 C7-2 多继承

#include using namespace std;class Base1{public: Base1(int x); ~Base1();};class Base2{public: Base2(int x); ~Base2();};class Base3{public: Base3(int x); ~Base3();};class Derived

2016-10-12 10:56:28 582

原创 C7-1 账户类

#include #include using namespace std;class Account{ string userName;public: Account(){}; Account(string name); void PrintUserName();};class CreditAccount : public Account{public: Cre

2016-10-12 10:17:24 759

原创 C5-2 数老鼠

/* students please write your program here */#include using namespace std;class Mouse{ /* Your code here! */public: static int num; Mouse() {num++; } Mouse(Mouse &p){ num++; } ~Mouse(){ num-

2016-10-09 13:30:33 911

原创 C5-1 “鱼额宝”

/* students please write your program here */#include using namespace std;class Yuebao{private: static double profitRate; double sum;public: static void setProfitRate(double rate) { profi

2016-10-09 13:14:13 595

原创 类编程作业

#include using namespace std;class Integer {private: int _num;public: //构造函数 Integer(int num) { _num = num; } //计算当前Integer 和 b之间的最大公约数 int gcd(Integer b) { int r=b._num; while (r != 0

2016-10-08 16:09:15 523

原创 7.6 7.7

#include#includeusing namespace std;struct Sales_data{ string const &isbn() const{ return bookNo; }; Sales_data &combine(const Sales_data&); string bookNo; unsigned units_sold = 0; d

2016-09-27 19:33:28 372

原创 7.4 7.5

#includeclass Person{private: string strName; string strAddress;public: string getName() const{ return strName; }//常量成员函数 string getAddress() const { return getAddress; }};

2016-09-27 16:51:11 396

原创 7.1

#include#includeusing namespace std;struct Sales_data{ std::string bookNo; unsigned units_sold = 0; double revenue = 0.0;};int main(){ Sales_data total; if (cin >> total.bookNo >> total.

2016-09-24 09:05:15 325

原创 6.44

#include#includeusing namespace std;inline bool is_shorter(const string &lft, const string &rht){ return lft.size() < rht.size();}int main(){ cout << is_shorter("pezy", "mooophy") << endl;

2016-09-24 08:38:49 395

原创 6.42

#include#include#includeusing namespace std;string make_plural(size_t ctr, const string &word, const string &ending = "s"){ return (ctr > 1) ? word + ending : word;}int main(){ cout << ma

2016-09-24 08:35:52 360

原创 6.33

#include#includeusing namespace std;void print(vector::iterator first, vector::iterator last){ if (first != last) { cout << *first << " "; print(++first, last); }}int main(){ vectorv

2016-09-23 14:55:30 401

原创 6.27

#include#includeusing namespace std;int sum(initializer_list const &il){ int sum = 0; for (auto i : il) sum += i; return sum;}int main(){ auto il = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }; cout

2016-09-23 14:43:32 264

原创 6.22

#include#includeusing namespace std;void swap(int *&lft, int *&rht){ auto tmp = lft; lft = rht; rht = tmp;}int main(){ int i = 42, j = 99; auto lft = &i; auto rht = &j; swap(lft, rht);

2016-09-23 14:09:47 303

原创 6.21

#includeusing namespace std;int large_one(const int i, const int *p){ return (i > *p) ? i : *p;}int main(){ int i = 6; cout << large_one(8, &i) << endl; return 0;}

2016-09-23 14:04:34 285

原创 6.17

#include#includeusing namespace std;bool any_capital(string const &str)//不需要修改 设为常量引用{ for (auto ch : str) if (isupper(ch)) return true; return false;}void to_lowercase(string &str)//需要修改

2016-09-23 13:46:56 381

原创 6.12

#includeusing namespace std;void swap(int &lhs,int &rhs)//lhs=left hand side { int temp = lhs; lhs = rhs; rhs = temp;}int main(){ for (int left, right; cin >> left >> right;) { swap(left

2016-09-23 11:16:42 269

原创 6.10

#includeusing namespace std;void swap(int *lhs, int *rhs){ int tmp; tmp = *lhs; *lhs = *rhs; *rhs = tmp;}int main(){ for (int lft, rht; cin >> lft>>rht;) { swap(&lft, &rht); cout << l

2016-09-23 11:01:05 215

原创 6.8

int fact(int val);int func();templateT abs(T i){ return i > 0 ? i : -i;}

2016-09-23 10:35:34 259

原创 6.7

#includeusing namespace std;size_t count_add(int n){ static size_t ctr = 0;//函数体内如果在定义静态变量的同时进行了初始化,则以后程序不再进行初始化操作(出现在函数内部的基本类型的的静态变量初始化语句只有在第一次调用才执行)//而对自动变量赋初值是在函数调用时进行,每调用一次函数重新给一次初值,相当于执行一次

2016-09-23 10:32:44 249

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除