第二天学习汇总

1.

#include <iostream >
using namespace std;
#define AR_SIZE 10
const int ar_size = 10;
enum{size=10};

int main()
{
	int ar[10];
	int br[AR_SIZE];
	int cr[ar_size];
	int dr[ar_size];
	return 0;

}

2.

#include<iostream>
using namespace std;

int main()
{
	int  ar[] = { 10,23,34,45,56,67,78,89,90,100,110,123 };
	int n = sizeof(ar) / sizeof(ar[0]);

	for (int i = 0; i < n; ++i)
	{
		cout << ar[i] << endl;
	}
	//int size=sizeof(ar);

	//cout<<size<<endl;//40


}

3.

#include <iostream>
using namespace std;

int main()
{
	int a = 10, b = 20;
	int c = a * b;//此处*为乘号;

	int* p=NULL;//此处*为声明指针;
	p = &a;
	*p = 100;//此处*为解引用;
	p=&b;
	*p = 200;//此处*为解引用;


	return 0;
}

4.

#include <iostream>
using namespace std;
int Get_YM_Day(int year, int month)
{
	int day = 0;
	switch(month)
	{
	case 1: day = 31; break;
	case 3: day = 31; break;
	case 5: day = 31; break;
	case 7: day = 31; break;

	}return 0;
}
int main()
{
	return 0;
}

5.

第二天学习汇总

6.

第二天学习汇总

7.

#include <stdio.h>
#include <stdlib.h>
main()
{ 
int n;
printf("请输入年份:\n");
scanf("%d",&n);
if (n%100==0)
if(n%400==0)
printf("是闰年");
else
printf("不是闰年");
else
if (n%4==0)
printf("是闰年");
else
printf("不是闰年"); 

}

8.

#include <iostream>
using namespace std;
void Print(int br[10])
{
	int size = sizeof(br);
	printf("size:%d\n,size");
}
int main()
{
	const int n = 10;  //{read,write}
	int ar[n] = { 12,23,34,45,56,67,78,89,90,100 };
	int* p = &ar[0];//int *p=ar;

	for (int i = 0; i < n; ++i)
	{
		printf("%08x=> %d\n", p, *p);
		p = p + 1;//p++;
		//printf("%d %d"\n,p[i],*(p+i));
		//printf("%d %d"\n,ar[i],*(ar+i));
	}
	return 0;
}

9.

第二天学习汇总

10.

第二天学习汇总

第二天学习汇总

11.

#include <iostream>
using namespace std;
int main()
{
	int a = 10;//10
	int b = 010;//8
	int c = 0x10;//16
	int d = 0b1010;//2

	return 0;
}

上一篇:MySQL之数据库多表查询


下一篇:中国市场迎来AR-HUD元年