变量作用域
#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<<std::endl; }
#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<<std::endl; }
什么是类和对象?张三找了一个女朋友,她的女朋友就是他的对象。搞笑一下,打个比方,我们都是人类,人类这个类的一个成员(对象)。怎么创建类呢?#include <iostream> using namespace std; class fenshu...
#include<iostream> using namespace std; int main() { cout << "The size of int is&nb...
#include<iostream> using namespace std; struct books{ char name[10]; int num; float price; }book; int&nb...
#include<iostream> using namespace std; void addarr(int *k,int len); //文中形如sizeof(x)/sizeof(x[0]) 是用数组占用空...