自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(12)
  • 收藏
  • 关注

原创 延迟循环

#include/* 等待你输入的系统时间为单位 之后进行下边的动作int main(){ using namespace std; cout<<"Enter the delay time, in secords: "; float secs; cin>>secs; clock_t delay=secs * CLOCKS_PER_SEC; cout<<"starting\a\n"

2015-03-24 07:38:49 322

原创 数组、模板类vector对象、模板类array对象

#include #include #include int main(){ using namespace std; double a1[4]={1.2,2.4,3.6,4.8}; vector a2(4); a2[0]=1.0/3.0; a2[1]=1.0/5.0; a2[2]=1.0/7.0; a2[3]=1.0/9.0; array a3={3.14,2.72,

2015-03-19 16:10:15 397

原创 指针学习(四)

struct inflatable //结构定义{ char name[20]; float volume; double price;};int main(){ using namespace std; inflatable * ps=new inflatable;//给结构分配内存空间 cout<<"Enter name of inflatable it

2015-03-17 10:06:17 335

原创 指针学习(三)

#include #include int main(){ using namespace std; char animal[20]="bear"; const char * bird="wren"; char * ps; cout<<animal<<" and "; cout<<bird<<endl; //cout<<ps<<endl; cou

2015-02-12 17:38:02 293

原创 指针学习(二)指针与数组

#include int main(){ using namespace std; double wages[3]={10000.0,20000.0,30000.0}; short stacks[3]={3,2,1}; //取得内存地址 double * pw=wages;//double * pw= &wages[0];与这种写法是相同的 short * ps

2015-02-11 17:07:20 200

原创 指针学习(一)

#include "stdafx.h"#include int main(){ using namespace std; int updates=6; int *p_updates;//指针需要说明类型 p_updates=&updates; //两种取值的方法 cout<<"Value:updates="<<updates; cout<<",*p_up

2015-02-10 17:39:16 268

原创 枚举类型学习

int main(){ using namespace std; enum spectrum{red,orange,yellow,green,blue,violet,indigo=100,ultraviolet}; //red、orange...这些第一个枚举量的值为0 第二个为1 可以显式的指定整数值来覆盖默认值 spectrum band; //band=3;不合法 i

2015-02-10 16:25:16 197

原创 共用体学习

#include struct widget{ char brand[20]; int type; union id //共用体 { long id_num; char id_char[20]; } id_val;};widget price;if (price.type==1){ cin>>price.id_val.id_num;

2015-02-10 14:49:08 217

原创 结构学习(一)

//充气产品结构声明struct inflatable { char name[20]; float volume; double price; };//注意一定要添加;int main(){ using namespace std; //struct inflatable hat;创建结构变量 struct可以省略 inflatable gues

2015-02-10 11:41:57 203

原创 数组学习(三)

#include "stdafx.h"#include #include #include int main(){ using namespace std; /*没有string类之前的用法 strcpy(charr1,charr2);//将charr2的值赋值给charr1 strcat(charr1,charr2);//将charr2的值附加到charr1的

2015-02-10 10:25:27 320

原创 学习数组(二)

//Tips:cin会抓取用户输入的文字进入数组 然后逐个进行赋值 所以用户输入多个单词是会出现混乱#includeint main(){ using namespace std; const int ArSize=20; char name[ArSize]; char dessert[ArSize]; cout<<"Enter your name:\n";

2015-02-09 16:36:50 172

原创 学习数组(一)

#includeint main(){ using namespace std; char dog[7]={'b','e','c','a','u',' ','2'}; cout<<dog; //测试是否能输出中间还有空字符的字符串 cin.get(); return 0;}//Tips:可以用以下的代码避免以上情况#includeint main

2015-02-09 14:43:47 259

空空如也

空空如也

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

TA关注的人

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