03
2020
11

C++ 数组的各类性质和用法

#include<iostream>  using namespace std; void addarr(int *k,int len); //文中形如sizeof(x)/sizeof(x[0]) 是用数组占用空间大小除以成员的大小,即得数组长度  //三种不同的数组声明方式  int x[5]={1,2,3,4,5}; int y[]={2,4,6,8,10};
28
2020
10

数据结构

#include<iostream> using namespace std; struct books{ char name[10]; int num; float price; }book; int main() { book.num=1; book.price=2.5; char x[10]="Hello",n; for(n=0;n<1
28
2020
10

C和C++中的字符串

/*C风格字符串的声明和使用  #include<cstdio.h> int main() { char x[]={'H','e','l','l','o',' ','C','+','+','\0'}; //等效于 char x[]="Hello
28
2020
10

Break和Continue的区别

#include<iostream>  using namespace std; int main() { int x=0; for(x=0;x<10;x++) { if(x==3) break; else cout << x; } cout << endl; for(x=0;x<10;x++) {
28
2020
10

变量作用域

#include<iostream> void print(); int main() { char a=0; for(a=0;a<20;a++) print(); return 0;  }  void print() { static int x=0;//静态变量声明,其值会一直保留  x++; std::cout<<x<
28
2020
10

函数声明和使用

#include<iostream> using namespace std; int sum(int a,int b);//函数声明  int main() { cout << sum(1,2);//函数调用  return 0; } int sum(int a,int b)//函数主体  { r
28
2020
10

数据类型及其占用空间

#include<iostream> using namespace std; int main() { cout << "The size of int is " <<sizeof(int) <<endl; cout << "The size&
28
2020
10

C++入门 输出Hello World

#include <iostream>using namespace std;int main(){     cout << "Hello, world!" << endl;    return 0;}它等效于#include <iostream
06
2019
11

C++的继承和派生

#include <iostream> using namespace std; class fenshu { public: int xuehao; int yuwen;  };   class wz_fenshu:public fenshu  {   public:   int shuxue; &
06
2019
11

C++的类和对象

什么是类和对象?张三找了一个女朋友,她的女朋友就是他的对象。搞笑一下,打个比方,我们都是人类,人类这个类的一个成员(对象)。怎么创建类呢?#include <iostream> using namespace std; class fenshu { public: int xuehao; int yuwen; int shuxue; }; int main ()

返回顶部