自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 3.8.2 SimpleStruct

#include using namespace std;struct Structurel{char c;int i;float f;double d;};int main(){ struct Structurel s1,s2; s1.c='a'; s1.i=1; s1.f=3.14; s1.d=0.00093; s2.c='a

2013-07-29 09:36:32 493

原创 3.7.2 Mathops

#include using namespace std;#define PRINT(STR,VAR)cout <<STR "="<<VAR<<endlint main(){int i,j,k;float u,v,w;cout<<"enter another integer:";cin>>k;PRINT("j",j); PRINT("k",k);i=j+k; PRINT("

2013-07-23 21:36:10 497

原创 3.6.3 Static2

#include using namespace std;void func(){int i=0;cout <<"i= "<<++i<<endl;}int main(){ for (int x=0;x<10;x++) func();}

2013-07-23 14:55:15 355

原创 3.6.3Static

#include using namespace std;void func(){static int i=0;cout <<"i= "<<++i<<endl;}int main(){ for (int x=0;x<10;x++) func();}

2013-07-23 14:53:21 416

原创 3.5.1 OnTheFly

#include using namespace std;int main(){{ int q=0; for(int i=0;i<100;i++){ q++; int p=12; } int p=1;}cout<<"Type characters:"<<endl;while(char c=cin.get()!='q'){

2013-07-23 13:57:42 398

原创 3.4.7 VoidPointer

#include using namespace std;int main(){void* vp;char c;int i;float f;double d;vp=&c;vp=&i;vp=&f;vp=&d;}

2013-07-23 13:39:36 382

原创 3.4.7 AllDefinitions

#include using namespace std;void f1(char c,int i,float f,double d);void f2(short int si,long int li,long double ld);void f3(unsigned char uc,unsigned int ui, unsigned short int usi,unsi

2013-07-23 13:36:47 465

原创 3.4.6 PassReference

#include using namespace std;void f(int& r){cout<<"r= "<<r<<endl;cout<<"&r= "<<&r<<endl;r=5;cout<<"r= "<<r<<end;}int main(){int x=47;cout<<"x= "<<x<<endl;cout<<"&x= "<<&x<<endl;f(&x);c

2013-07-23 13:26:06 337

原创 3.4.5PassAddress

#include using namespace std;void f(int* p){ cout<<"p= "<<p<<endl; cout<<"*p= "<<*p<<endl; *p=5; cout<<"p= "<<p<<endl;}int main(){int x=47;cout<<"x= "<<x<<endl;cout<<"&x= "<<&

2013-07-23 13:20:49 358

原创 3.4.5 PassByValue

#include using namespace std;void f(int a){cout<<"a= "<<a<<endl;a=5;cout<<"a= "<<a<<endl;}int main(){int x=47;cout<<"x= "<<x<<endl;f(x);cout<<"x= "<<x<<endl;}

2013-07-23 13:11:16 387

原创 3.4.4 YourPets2

#include using namespace std;int dog,cat,bird,fish;void f(int pet){cout<<"pet id number: " << pet << endl;}int main(){int i,j,k;cout<<"f():"<<(long)&f<<endl;cout<<"dog: "<<(long)&dog<<en

2013-07-23 12:48:39 384

原创 3.4.4 YourPets1

#include using namespace std;int dog,cat,bird,fish;void f(int pet){cout<<"pet id number: " << pet << endl;}int main(){int i,j,k;}

2013-07-23 12:41:24 423

原创 3.4.3 Srecify

#include using namespace std;int main(){char c;unsigned char cu;int i;unsigned int iu;short int is;short iis;unsigned short int isu;unsigned short iisu;long int il;long iil;unsigned lon

2013-07-23 12:38:14 602

原创 3.3.2 AutoIncrement

#include using namespace std;int main(){int i=0;int j=0;cout<<++j<<endl;cout<<j++<<endl;cout<<--i<<endl;cout<<i--<<endl;}

2013-07-23 11:37:28 338

原创 3.2.9CatsInHats

#include using namespace std;void removeHat(char cat){for(char c='A';c<cat;c++) cout<< " "; if(cat<='Z'){ cout<<"cat"<<cat<<endl; removeHat(cat+1); } else cout<<"VOO

2013-07-23 11:27:02 438

原创 3.2.8 gotokeyword

#include using namespace std;int main(){long val=0;for(int i=1;i<1000;i++){ for (int j=1;j<100;j+=10){ val=i*j; if(val>47000) goto bottom; }}bottom: cout

2013-07-23 10:00:23 346

原创 3.2.7Menu2

#include using namespace std;int main(){ bool quit=false; while(quit == false){ cout << "Select a,b,c or q to quit: " ; char response; cin >> response; switc

2013-07-23 09:54:46 329

原创 3.2.6 menu

#include using namespace std;int main(){ char c; while(true){ cout <<"MAIN NENU: "<<endl; cout"; cin>>c; if(c=='q') break; if(c=='l'){ cout<<"LEFT MENU:"<<endl;

2013-07-23 08:31:47 413

原创 3.2.5 charlist

#include using namespace std;int main(){for(int i=0;i<128;i=i+1) if(i!=26) cout<<"value: "<<i <<"character: " <<char(i) <<endl;}

2013-07-23 08:14:34 424

原创 3.2.4 guess2

#include using namespace std;int main(){int secret = 15;int guess ;do{ cout << "guess the number:"; cin>>guess;}while(guess!=secret);cout<<"You got it!" <<endl;}

2013-07-23 08:08:43 358

原创 3.2.3 guess

#include using namespace std;int main(){int secret = 15;int guess = 0;while (guess != secret){ cout << "guess the number: "; cin>>guess;}cout<<"you guessend it!"<<endl;}

2013-07-23 08:02:46 354

原创 3.2.2 ifthen

#include using namespace std;int main(){int i;cout<<"type a number and 'Enter'"<<endl;cin>>i;if(i>5) cout << "It's greater than 5" <<endl;else if(i<5) cout << "It's less than 5"

2013-07-23 07:59:22 329

原创 3.1.1 return

#include using namespace std;char cfunc(int i){if(i==0) return 'a';if(i==1) return 'g';if(i==5) return 'z';return 'c';}int main(){ cout<<"type an integer: "; int val; cin>>val;

2013-07-23 07:53:49 353

原创 2.7 Intvector

#include #include #include #include using namespace std;int main(){vector v;for (int i=0; i<10 ; i++) v.push_back(i);for (int i=0; i< v.size() ; i++ ) cout << v[i] << " , ";cout <<

2013-07-22 18:56:11 363

原创 2.7 Fillvector

#include #include #include #include int main(){ vector v; ifstream in("Fillvetor.opp"); string line; while (getline(in,line)) v.push_back(line); for(int i = 0; i < v

2013-07-22 18:50:06 341

原创 2.7 GetWords

#include #include #include #include int main(){ vector words; ifstream in("GetWords.cpp"); string word; while(in >> word){ words.push_back(word); for(int i=0 ;i

2013-07-22 18:46:48 358

原创 2.5 FillString

#include #include #include using namespace std;int main(){ ifstream in("FillString.cpp") string s,line; while (getline(in,line)) s += line + "\n"; cout << s ;}

2013-07-22 18:44:08 558

原创 2.6 scopy

#include #include #include using namespace std;int main(){ ifstream in("Scopy.cpp"); ofstream out("Scopy2.cpp"); string s; while (getline(in,s)) out<< s << "\n";}

2013-07-22 18:42:04 383

原创 2.5 HelloStrings

#include #include using namespace std;int main(){ string s1,s2; string s3="Hello,World."; string s4("I am"); s2="Today"; s1 = s3 + " " + s4 ; s1 +=" 8 " ; cout << s1 + s2 +

2013-07-22 18:38:59 335

原创 2.4.3 CallHello

#include using namespace std;int main(){ system("Hello");}

2013-07-22 18:35:40 307

原创 2.4 Stream2

#include using namespace std;int main(){ cout << "a number in decimal: " << dec << 15 << endl; //15十进制 cout << "in octal: " << oct << 15 << endl; //15八进制 cout << "in hex: " <

2013-07-22 18:33:38 368

原创 2.4.2 Numconv

#include using namespace std;int main(){ int number; cout<<"Enter a decimal number: " ; cin>>number; cout << "value in octal = 0 " << oct << number << endl; cout << "value in hex

2013-07-22 18:30:30 327

原创 2.4.1concat

#include using namespace std;int main(){ cout <<"This is far too long to put on a " "single line but it can be broken up with" "no ill effects\nas long as there is no"

2013-07-22 18:28:29 352

原创 2.3.4 "Hello,World!"

//Hello.cpp#include using namespace std;int main(){ cout << "Hello world!I am" << 8 << "Today!" << endl; return 0;}

2013-07-22 17:41:24 288

空空如也

空空如也

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

TA关注的人

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